diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-23 14:43:14 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-15 18:11:44 +0200 |
commit | 027e7e574e7a4488d47cd4133e98d518210b1e56 (patch) | |
tree | c45f05457509b7d99c39a3889119c04c4aee39e3 /src/core/renderer | |
parent | 2dce0008ce53d27d281ad2dc00eb32d25ae5fc84 (diff) |
Adaptations for Chromium 88
Change-Id: Ie66e95dbb9fbcafe961bb98d5c277f8c32d66b96
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/core/renderer')
5 files changed, 5 insertions, 586 deletions
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index ad559ae54..de3a76d78 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -261,16 +261,6 @@ void ContentRendererClientQt::RunScriptsAtDocumentIdle(content::RenderFrame *ren #endif } -bool ContentRendererClientQt::HasErrorPage(int httpStatusCode) -{ - // Use an internal error page, if we have one for the status code. - if (!error_page::LocalizedError::HasStrings(error_page::Error::kHttpErrorDomain, httpStatusCode)) { - return false; - } - - return true; -} - // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). void ContentRendererClientQt::PrepareErrorPage(content::RenderFrame *renderFrame, const blink::WebURLError &web_error, @@ -284,13 +274,13 @@ void ContentRendererClientQt::PrepareErrorPage(content::RenderFrame *renderFrame } void ContentRendererClientQt::PrepareErrorPageForHttpStatusError(content::RenderFrame *renderFrame, - const GURL &unreachable_url, + const blink::WebURLError &error, const std::string &httpMethod, int http_status, std::string *errorHtml) { GetNavigationErrorStringsInternal(renderFrame, httpMethod, - error_page::Error::HttpError(unreachable_url, http_status), + error_page::Error::HttpError(error.url(), http_status), errorHtml); } @@ -386,7 +376,7 @@ bool ContentRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_ if (!found) *plugin = LoadablePluginPlaceholderQt::CreateLoadableMissingPlugin(render_frame, params)->plugin(); else - *plugin = render_frame->CreatePlugin(info, params, nullptr); + *plugin = render_frame->CreatePlugin(info, params); #endif // BUILDFLAG(ENABLE_PLUGINS) return true; } @@ -633,10 +623,4 @@ void ContentRendererClientQt::WillSendRequest(blink::WebLocalFrame *frame, #endif } -bool ContentRendererClientQt::RequiresWebComponentsV0(const GURL &url) -{ - Q_UNUSED(url); - return false; -} - } // namespace QtWebEngineCore diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index a0faec531..3b2e5e9d6 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -92,17 +92,16 @@ public: void RenderThreadStarted() override; void ExposeInterfacesToBrowser(mojo::BinderMap* binders) override; void RenderFrameCreated(content::RenderFrame *render_frame) override; - bool HasErrorPage(int http_status_code) override; void PrepareErrorPage(content::RenderFrame *render_frame, const blink::WebURLError &error, const std::string &http_method, std::string *error_html) override; void PrepareErrorPageForHttpStatusError(content::RenderFrame *render_frame, - const GURL &unreachable_url, + const blink::WebURLError &error, const std::string &http_method, int http_status, - std::string *error_html) override; + std::string *error_html) override; uint64_t VisitedLinkHash(const char *canonical_url, size_t length) override; bool IsLinkVisited(uint64_t linkHash) override; @@ -129,8 +128,6 @@ public: GURL *new_url, bool *attach_same_site_cookies) override; - bool RequiresWebComponentsV0(const GURL &url) override; - #if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) chrome::WebRtcLoggingAgentImpl *GetWebRtcLoggingAgent(); #endif diff --git a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp b/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp deleted file mode 100644 index 9af05fd08..000000000 --- a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// This is based on chrome/renderer/pepper/pepper_flash_renderer_host.cc: -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. - -#include "pepper_flash_renderer_host_qt.h" - -#include <map> -#include <vector> - -#include "base/lazy_instance.h" -#include "base/macros.h" -#include "base/metrics/histogram_macros.h" -#include "base/strings/string_util.h" -#include "content/public/renderer/pepper_plugin_instance.h" -#include "content/public/renderer/render_thread.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ipc/ipc_message_macros.h" -#include "net/http/http_util.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/trusted/ppb_browser_font_trusted.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/proxy/host_dispatcher.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/resource_message_params.h" -#include "ppapi/proxy/serialized_structs.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_image_data_api.h" -#include "skia/ext/platform_canvas.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkMatrix.h" -#include "third_party/skia/include/core/SkPaint.h" -#include "third_party/skia/include/core/SkPoint.h" -#include "third_party/skia/include/core/SkTextBlob.h" -#include "third_party/skia/include/core/SkTypeface.h" -#include "third_party/skia/include/private/SkTemplates.h" -#include "ui/gfx/geometry/rect.h" -#include "url/gurl.h" - -using ppapi::thunk::EnterResourceNoLock; -using ppapi::thunk::PPB_ImageData_API; - -namespace { - -// Some non-simple HTTP request headers that Flash may set. -// (Please see http://www.w3.org/TR/cors/#simple-header for the definition of -// simple headers.) -// -// The list and the enum defined below are used to collect data about request -// headers used in PPB_Flash.Navigate() calls, in order to understand the impact -// of rejecting PPB_Flash.Navigate() requests with non-simple headers. -// -// TODO(yzshen): We should be able to remove the histogram recording code once -// we get the answer. -const char* const kRejectedHttpRequestHeaders[] = { - "authorization", // - "cache-control", // - "content-encoding", // - "content-md5", // - "content-type", // If the media type is not one of those covered by the - // simple header definition. - "expires", // - "from", // - "if-match", // - "if-none-match", // - "if-range", // - "if-unmodified-since", // - "pragma", // - "referer" // -}; - -// Please note that new entries should be added right above -// FLASH_NAVIGATE_USAGE_ENUM_COUNT, and existing entries shouldn't be re-ordered -// or removed, since this ordering is used in a histogram. -enum FlashNavigateUsage { - // This section must be in the same order as kRejectedHttpRequestHeaders. - REJECT_AUTHORIZATION = 0, - REJECT_CACHE_CONTROL, - REJECT_CONTENT_ENCODING, - REJECT_CONTENT_MD5, - REJECT_CONTENT_TYPE, - REJECT_EXPIRES, - REJECT_FROM, - REJECT_IF_MATCH, - REJECT_IF_NONE_MATCH, - REJECT_IF_RANGE, - REJECT_IF_UNMODIFIED_SINCE, - REJECT_PRAGMA, - REJECT_REFERER, - - // The navigate request is rejected because of headers not listed above - // (e.g., custom headers). - REJECT_OTHER_HEADERS, - - // Total number of rejected navigate requests. - TOTAL_REJECTED_NAVIGATE_REQUESTS, - - // Total number of navigate requests. - TOTAL_NAVIGATE_REQUESTS, - FLASH_NAVIGATE_USAGE_ENUM_COUNT -}; - -static base::LazyInstance<std::map<std::string, FlashNavigateUsage>>:: - DestructorAtExit g_rejected_headers = LAZY_INSTANCE_INITIALIZER; - -bool IsSimpleHeader(const std::string& lower_case_header_name, - const std::string& header_value) -{ - if (lower_case_header_name == "accept" || - lower_case_header_name == "accept-language" || - lower_case_header_name == "content-language") - return true; - - if (lower_case_header_name == "content-type") { - std::string lower_case_mime_type; - std::string lower_case_charset; - bool had_charset = false; - net::HttpUtil::ParseContentType(header_value, - &lower_case_mime_type, - &lower_case_charset, - &had_charset, - NULL); - return lower_case_mime_type == "application/x-www-form-urlencoded" || - lower_case_mime_type == "multipart/form-data" || - lower_case_mime_type == "text/plain"; - } - - return false; -} - -void RecordFlashNavigateUsage(FlashNavigateUsage usage) -{ - DCHECK_NE(FLASH_NAVIGATE_USAGE_ENUM_COUNT, usage); - UMA_HISTOGRAM_ENUMERATION( - "Plugin.FlashNavigateUsage", - usage, - FLASH_NAVIGATE_USAGE_ENUM_COUNT); -} - -} // namespace - -namespace QtWebEngineCore { - -PepperFlashRendererHostQt::PepperFlashRendererHostQt( - content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ResourceHost(host->GetPpapiHost(), instance, resource), - host_(host), - weak_factory_(this) -{ -} - -PepperFlashRendererHostQt::~PepperFlashRendererHostQt() { - // This object may be destroyed in the middle of a sync message. If that is - // the case, make sure we respond to all the pending navigate calls. - std::vector<ppapi::host::ReplyMessageContext>::reverse_iterator it; - for (it = navigate_replies_.rbegin(); it != navigate_replies_.rend(); ++it) - SendReply(*it, IPC::Message()); -} - -int32_t PepperFlashRendererHostQt::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) -{ - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashRendererHostQt, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetProxyForURL, - OnGetProxyForURL) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_SetInstanceAlwaysOnTop, - OnSetInstanceAlwaysOnTop) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_DrawGlyphs, - OnDrawGlyphs) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_Navigate, OnNavigate) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_IsRectTopmost, - OnIsRectTopmost) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_InvokePrinting, - OnInvokePrinting) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashRendererHostQt::OnGetProxyForURL( - ppapi::host::HostMessageContext* host_context, - const std::string& url) -{ - GURL gurl(url); - if (!gurl.is_valid()) - return PP_ERROR_FAILED; - std::string proxy; - bool result = content::RenderThread::Get()->ResolveProxy(gurl, &proxy); - if (!result) - return PP_ERROR_FAILED; - host_context->reply_msg = PpapiPluginMsg_Flash_GetProxyForURLReply(proxy); - return PP_OK; -} - -int32_t PepperFlashRendererHostQt::OnSetInstanceAlwaysOnTop( - ppapi::host::HostMessageContext* host_context, - bool on_top) -{ - content::PepperPluginInstance* plugin_instance = - host_->GetPluginInstance(pp_instance()); - if (plugin_instance) - plugin_instance->SetAlwaysOnTop(on_top); - return PP_OK; -} - -int32_t PepperFlashRendererHostQt::OnDrawGlyphs( - ppapi::host::HostMessageContext* host_context, - ppapi::proxy::PPBFlash_DrawGlyphs_Params params) -{ - if (params.glyph_indices.size() != params.glyph_advances.size() || - params.glyph_indices.empty()) - return PP_ERROR_FAILED; - - int weight = (params.font_desc.weight + 1) * 100; - SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant; - if (params.font_desc.italic) - slant = SkFontStyle::kItalic_Slant; - SkFontStyle style(weight, SkFontStyle::kNormal_Width, slant); - sk_sp<SkTypeface> typeface( - SkTypeface::MakeFromName(params.font_desc.face.c_str(), style)); - if (!typeface) - return PP_ERROR_FAILED; - - EnterResourceNoLock<PPB_ImageData_API> enter(params.image_data.host_resource(), true); - if (enter.failed()) - return PP_ERROR_FAILED; - - PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(enter.object()); - SkCanvas* canvas = image->GetCanvas(); - bool needs_unmapping = false; - if (!canvas) { - needs_unmapping = true; - image->Map(); - canvas = image->GetCanvas(); - if (!canvas) - return PP_ERROR_FAILED; // Failure mapping. - } - - SkAutoCanvasRestore acr(canvas, true); - - // Clip is applied in pixels before the transform. - SkRect clip_rect = { - SkIntToScalar(params.clip.point.x), SkIntToScalar(params.clip.point.y), - SkIntToScalar(params.clip.point.x + params.clip.size.width), - SkIntToScalar(params.clip.point.y + params.clip.size.height)}; - canvas->clipRect(clip_rect); - - SkMatrix matrix; - matrix.set(SkMatrix::kMScaleX, SkFloatToScalar(params.transformation[0][0])); - matrix.set(SkMatrix::kMSkewX, SkFloatToScalar(params.transformation[0][1])); - matrix.set(SkMatrix::kMTransX, SkFloatToScalar(params.transformation[0][2])); - matrix.set(SkMatrix::kMSkewY, SkFloatToScalar(params.transformation[1][0])); - matrix.set(SkMatrix::kMScaleY, SkFloatToScalar(params.transformation[1][1])); - matrix.set(SkMatrix::kMTransY, SkFloatToScalar(params.transformation[1][2])); - matrix.set(SkMatrix::kMPersp0, SkFloatToScalar(params.transformation[2][0])); - matrix.set(SkMatrix::kMPersp1, SkFloatToScalar(params.transformation[2][1])); - matrix.set(SkMatrix::kMPersp2, SkFloatToScalar(params.transformation[2][2])); - canvas->concat(matrix); - - SkPaint paint; - paint.setColor(params.color); - - SkFont font(std::move(typeface), SkIntToScalar(params.font_desc.size)); - font.setHinting(SkFontHinting::kFull); - if (params.allow_subpixel_aa) { - font.setSubpixel(true); - font.setEdging(SkFont::Edging::kSubpixelAntiAlias); - } - - SkScalar x = SkIntToScalar(params.position.x); - SkScalar y = SkIntToScalar(params.position.y); - - // Build up the skia advances. - size_t glyph_count = params.glyph_indices.size(); - if (glyph_count) { - SkTextBlobBuilder builder; - auto rec = builder.allocRunPos(font, glyph_count); - memcpy(rec.glyphs, ¶ms.glyph_indices[0], glyph_count * 2); - SkPoint* pos = reinterpret_cast<SkPoint*>(rec.pos); - for (uint32_t i = 0; i < glyph_count; i++) { - pos[i].set(x, y); - x += SkFloatToScalar(params.glyph_advances[i].x); - y += SkFloatToScalar(params.glyph_advances[i].y); - } - canvas->drawTextBlob(builder.make(), 0, 0, paint); - } - - if (needs_unmapping) - image->Unmap(); - - return PP_OK; -} - -// CAUTION: This code is subtle because Navigate is a sync call which may -// cause re-entrancy or cause the instance to be destroyed. If the instance -// is destroyed we need to ensure that we respond to all outstanding sync -// messages so that the plugin process does not remain blocked. -int32_t PepperFlashRendererHostQt::OnNavigate( - ppapi::host::HostMessageContext* host_context, - const ppapi::URLRequestInfoData& data, - const std::string& target, - bool from_user_action) -{ - // If our PepperPluginInstance is already destroyed, just return a failure. - content::PepperPluginInstance* plugin_instance = - host_->GetPluginInstance(pp_instance()); - if (!plugin_instance) - return PP_ERROR_FAILED; - - std::map<std::string, FlashNavigateUsage>& rejected_headers = - g_rejected_headers.Get(); - if (rejected_headers.empty()) { - for (size_t i = 0; i < base::size(kRejectedHttpRequestHeaders); ++i) - rejected_headers[kRejectedHttpRequestHeaders[i]] = - static_cast<FlashNavigateUsage>(i); - } - - net::HttpUtil::HeadersIterator header_iter( - data.headers.begin(), data.headers.end(), "\n\r"); - bool rejected = false; - while (header_iter.GetNext()) { - std::string lower_case_header_name = - base::ToLowerASCII(header_iter.name()); - if (!IsSimpleHeader(lower_case_header_name, header_iter.values())) { - rejected = true; - - std::map<std::string, FlashNavigateUsage>::const_iterator iter = - rejected_headers.find(lower_case_header_name); - FlashNavigateUsage usage = - iter != rejected_headers.end() ? iter->second : REJECT_OTHER_HEADERS; - RecordFlashNavigateUsage(usage); - } - } - - RecordFlashNavigateUsage(TOTAL_NAVIGATE_REQUESTS); - if (rejected) { - RecordFlashNavigateUsage(TOTAL_REJECTED_NAVIGATE_REQUESTS); - return PP_ERROR_NOACCESS; - } - - // Navigate may call into Javascript (e.g. with a "javascript:" URL), - // or do things like navigate away from the page, either one of which will - // need to re-enter into the plugin. It is safe, because it is essentially - // equivalent to NPN_GetURL, where Flash would expect re-entrancy. - ppapi::proxy::HostDispatcher* host_dispatcher = - ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); - host_dispatcher->set_allow_plugin_reentrancy(); - - // Grab a weak pointer to ourselves on the stack so we can check if we are - // still alive. - base::WeakPtr<PepperFlashRendererHostQt> weak_ptr = weak_factory_.GetWeakPtr(); - // Keep track of reply contexts in case we are destroyed during a Navigate - // call. Even if we are destroyed, we still need to send these replies to - // unblock the plugin process. - navigate_replies_.push_back(host_context->MakeReplyMessageContext()); - plugin_instance->Navigate(data, target.c_str(), from_user_action); - // This object might have been destroyed by this point. If it is destroyed - // the reply will be sent in the destructor. Otherwise send the reply here. - if (weak_ptr.get()) { - SendReply(navigate_replies_.back(), IPC::Message()); - navigate_replies_.pop_back(); - } - - // Return PP_OK_COMPLETIONPENDING so that no reply is automatically sent. - return PP_OK_COMPLETIONPENDING; -} - -int32_t PepperFlashRendererHostQt::OnIsRectTopmost( - ppapi::host::HostMessageContext* host_context, - const PP_Rect& rect) -{ - content::PepperPluginInstance* plugin_instance = - host_->GetPluginInstance(pp_instance()); - if (plugin_instance && - plugin_instance->IsRectTopmost( - gfx::Rect( - rect.point.x, - rect.point.y, - rect.size.width, - rect.size.height))) - return PP_OK; - return PP_ERROR_FAILED; -} - -int32_t PepperFlashRendererHostQt::OnInvokePrinting( - ppapi::host::HostMessageContext* host_context) -{ - return PP_ERROR_FAILED; -} - -} //QtWebEngineCore diff --git a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.h b/src/core/renderer/pepper/pepper_flash_renderer_host_qt.h deleted file mode 100644 index ae6bc0876..000000000 --- a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PEPPER_FLASH_RENDERER_HOST_QT_H -#define PEPPER_FLASH_RENDERER_HOST_QT_H - -#include <string> -#include <vector> - -#include "base/memory/weak_ptr.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/resource_host.h" - -struct PP_Rect; - -namespace ppapi { -struct URLRequestInfoData; -} - -namespace ppapi { -namespace proxy { -struct PPBFlash_DrawGlyphs_Params; -} -} - -namespace content { -class RendererPpapiHost; -} - -namespace QtWebEngineCore { - -class PepperFlashRendererHostQt : public ppapi::host::ResourceHost { -public: - PepperFlashRendererHostQt(content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - ~PepperFlashRendererHostQt() override; - - // ppapi::host::ResourceHost override. - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - -private: - int32_t OnGetProxyForURL(ppapi::host::HostMessageContext* host_context, - const std::string& url); - int32_t OnSetInstanceAlwaysOnTop( - ppapi::host::HostMessageContext* host_context, - bool on_top); - int32_t OnDrawGlyphs(ppapi::host::HostMessageContext* host_context, - ppapi::proxy::PPBFlash_DrawGlyphs_Params params); - int32_t OnNavigate(ppapi::host::HostMessageContext* host_context, - const ppapi::URLRequestInfoData& data, - const std::string& target, - bool from_user_action); - int32_t OnIsRectTopmost(ppapi::host::HostMessageContext* host_context, - const PP_Rect& rect); - int32_t OnInvokePrinting(ppapi::host::HostMessageContext* host_context); - - // A stack of ReplyMessageContexts to track Navigate() calls which have not - // yet been replied to. - std::vector<ppapi::host::ReplyMessageContext> navigate_replies_; - - content::RendererPpapiHost* host_; - base::WeakPtrFactory<PepperFlashRendererHostQt> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHostQt); -}; - -} //QtWebEngineCore -#endif // PEPPER_FLASH_RENDERER_HOST_QT_H diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp index 1b9de4d4d..83dcf8157 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp @@ -43,7 +43,6 @@ // found in the LICENSE.Chromium file. #include "pepper_renderer_host_factory_qt.h" -#include "pepper_flash_renderer_host_qt.h" #include "qtwebenginecoreglobal_p.h" #include "base/memory/ptr_util.h" @@ -82,25 +81,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe if (!host_->IsValidInstance(instance)) return nullptr; - if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_FLASH)) { - switch (message.type()) { - case PpapiHostMsg_Flash_Create::ID: - return base::WrapUnique(new PepperFlashRendererHostQt(host_, instance, resource)); - case PpapiHostMsg_FlashMenu_Create::ID: { - ppapi::host::ReplyMessageContext reply_context( - ppapi::proxy::ResourceMessageReplyParams(resource, 0), - NULL, - MSG_ROUTING_NONE); - reply_context.params.set_result(PP_ERROR_USERCANCEL); - host_->GetPpapiHost()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(-1)); - break; - } - case PpapiHostMsg_FlashFullscreen_Create::ID: - // Not implemented - break; - } - } - // TODO(raymes): PDF also needs access to the FlashFontFileHost currently. // We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get // rid of its use in PDF if possible. @@ -114,9 +94,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe return base::WrapUnique(new PepperFlashFontFileHost(host_, instance, resource, description, charset)); break; } - case PpapiHostMsg_FlashDRM_Create::ID: - // Not implemented - break; } } |