From 5e2406081e18616e2941f52db86569ad4566e9f7 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 20 Jun 2018 06:14:24 +0530 Subject: [PATCH] build: move pepper flash behind feature flag --- atom/browser/atom_browser_client.cc | 9 +- atom/renderer/renderer_client_base.cc | 7 +- .../chrome_browser_pepper_host_factory.cc | 94 ----- .../chrome_browser_pepper_host_factory.h | 38 -- .../renderer_host/pepper/monitor_finder_mac.h | 52 --- .../pepper/monitor_finder_mac.mm | 61 --- .../pepper/pepper_broker_message_filter.cc | 53 --- .../pepper/pepper_broker_message_filter.h | 51 --- .../pepper/pepper_flash_browser_host.cc | 111 ------ .../pepper/pepper_flash_browser_host.h | 59 --- .../pepper_flash_clipboard_message_filter.cc | 372 ------------------ .../pepper_flash_clipboard_message_filter.h | 76 ---- .../pepper/pepper_flash_drm_host.cc | 216 ---------- .../pepper/pepper_flash_drm_host.h | 55 --- ...per_isolated_file_system_message_filter.cc | 106 ----- ...pper_isolated_file_system_message_filter.h | 76 ---- .../chrome_renderer_pepper_host_factory.cc | 99 ----- .../chrome_renderer_pepper_host_factory.h | 34 -- .../pepper/pepper_flash_font_file_host.cc | 105 ----- .../pepper/pepper_flash_font_file_host.h | 56 --- .../pepper/pepper_flash_fullscreen_host.cc | 42 -- .../pepper/pepper_flash_fullscreen_host.h | 35 -- .../renderer/pepper/pepper_flash_menu_host.cc | 201 ---------- .../renderer/pepper/pepper_flash_menu_host.h | 69 ---- .../pepper/pepper_flash_renderer_host.cc | 370 ----------------- .../pepper/pepper_flash_renderer_host.h | 68 ---- .../chrome/renderer/pepper/pepper_helper.cc | 30 -- .../chrome/renderer/pepper/pepper_helper.h | 26 -- .../pepper_shared_memory_message_filter.cc | 63 --- .../pepper_shared_memory_message_filter.h | 46 --- electron.gyp | 24 ++ features.gypi | 2 + filenames.gypi | 28 -- 33 files changed, 39 insertions(+), 2695 deletions(-) delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.h delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc delete mode 100644 chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h delete mode 100644 chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc delete mode 100644 chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.h delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.h delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.cc delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.h delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.h delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_helper.cc delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_helper.h delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc delete mode 100644 chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.h diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 9475e5f79fa6..d109b73033ce 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -32,7 +32,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "chrome/browser/printing/printing_message_filter.h" -#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" #include "chrome/browser/speech/tts_message_filter.h" #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/client_certificate_delegate.h" @@ -62,6 +61,10 @@ #include "net/ssl/client_cert_store.h" #endif +#if defined(ENABLE_PEPPER_FLASH) +#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" +#endif // defined(ENABLE_PEPPER_FLASH) + using content::BrowserThread; namespace atom { @@ -349,8 +352,10 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches( } void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) { +#if defined(ENABLE_PEPPER_FLASH) host->GetPpapiHost()->AddHostFactoryFilter( - base::WrapUnique(new chrome::ChromeBrowserPepperHostFactory(host))); + base::WrapUnique(new ChromeBrowserPepperHostFactory(host))); +#endif } void AtomBrowserClient::GetGeolocationRequestContext( diff --git a/atom/renderer/renderer_client_base.cc b/atom/renderer/renderer_client_base.cc index aca4f9360316..eeac3ff27625 100644 --- a/atom/renderer/renderer_client_base.cc +++ b/atom/renderer/renderer_client_base.cc @@ -19,7 +19,6 @@ #include "base/command_line.h" #include "base/strings/string_split.h" #include "chrome/renderer/media/chrome_key_systems.h" -#include "chrome/renderer/pepper/pepper_helper.h" #include "chrome/renderer/printing/print_web_view_helper.h" #include "chrome/renderer/tts_dispatcher.h" #include "content/public/common/content_constants.h" @@ -46,6 +45,10 @@ #include "atom/common/atom_constants.h" #endif // defined(ENABLE_PDF_VIEWER) +#if defined(ENABLE_PEPPER_FLASH) +#include "chrome/renderer/pepper/pepper_helper.h" +#endif // defined(ENABLE_PEPPER_FLASH) + namespace atom { namespace { @@ -148,7 +151,9 @@ void RendererClientBase::RenderFrameCreated( #if defined(TOOLKIT_VIEWS) new AutofillAgent(render_frame); #endif +#if defined(ENABLE_PEPPER_FLASH) new PepperHelper(render_frame); +#endif new ContentSettingsObserver(render_frame); new printing::PrintWebViewHelper(render_frame); diff --git a/chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc b/chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc deleted file mode 100644 index 28229a178e6c..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc +++ /dev/null @@ -1,94 +0,0 @@ -// 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 file. - -#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" - -#include "build/build_config.h" -#include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h" -#include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h" -#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h" -#include "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h" -#include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "ppapi/host/message_filter_host.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/ppapi_permissions.h" - -using ppapi::host::MessageFilterHost; -using ppapi::host::ResourceHost; -using ppapi::host::ResourceMessageFilter; - -namespace chrome { - -ChromeBrowserPepperHostFactory::ChromeBrowserPepperHostFactory( - content::BrowserPpapiHost* host) - : host_(host) {} - -ChromeBrowserPepperHostFactory::~ChromeBrowserPepperHostFactory() {} - -std::unique_ptr -ChromeBrowserPepperHostFactory::CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) { - DCHECK(host == host_->GetPpapiHost()); - - // Make sure the plugin is giving us a valid instance for this resource. - if (!host_->IsValidInstance(instance)) - return std::unique_ptr(); - - // Private interfaces. - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_PRIVATE)) { - switch (message.type()) { - case PpapiHostMsg_Broker_Create::ID: { - scoped_refptr broker_filter( - new PepperBrokerMessageFilter(instance, host_)); - return std::unique_ptr(new MessageFilterHost( - host_->GetPpapiHost(), instance, resource, broker_filter)); - } - } - } - - // Flash interfaces. - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_FLASH)) { - switch (message.type()) { - case PpapiHostMsg_Flash_Create::ID: - return std::unique_ptr( - new PepperFlashBrowserHost(host_, instance, resource)); - case PpapiHostMsg_FlashClipboard_Create::ID: { - scoped_refptr clipboard_filter( - new PepperFlashClipboardMessageFilter); - return std::unique_ptr(new MessageFilterHost( - host_->GetPpapiHost(), instance, resource, clipboard_filter)); - } - case PpapiHostMsg_FlashDRM_Create::ID: - return std::unique_ptr( - new chrome::PepperFlashDRMHost(host_, instance, resource)); - } - } - - // Permissions for the following interfaces will be checked at the - // time of the corresponding instance's methods calls (because - // permission check can be performed only on the UI - // thread). Currently these interfaces are available only for - // whitelisted apps which may not have access to the other private - // interfaces. - if (message.type() == PpapiHostMsg_IsolatedFileSystem_Create::ID) { - PepperIsolatedFileSystemMessageFilter* isolated_fs_filter = - PepperIsolatedFileSystemMessageFilter::Create(instance, host_); - if (!isolated_fs_filter) - return std::unique_ptr(); - return std::unique_ptr( - new MessageFilterHost(host, instance, resource, isolated_fs_filter)); - } - - return std::unique_ptr(); -} - -} // namespace chrome diff --git a/chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h b/chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h deleted file mode 100644 index 84385140ceca..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h +++ /dev/null @@ -1,38 +0,0 @@ -// 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 file. - -#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_CHROME_BROWSER_PEPPER_HOST_FACTORY_H_ -#define CHROME_BROWSER_RENDERER_HOST_PEPPER_CHROME_BROWSER_PEPPER_HOST_FACTORY_H_ - -#include "base/macros.h" -#include "ppapi/host/host_factory.h" - -namespace content { -class BrowserPpapiHost; -} // namespace content - -namespace chrome { - -class ChromeBrowserPepperHostFactory : public ppapi::host::HostFactory { - public: - // Non-owning pointer to the filter must outlive this class. - explicit ChromeBrowserPepperHostFactory(content::BrowserPpapiHost* host); - ~ChromeBrowserPepperHostFactory() override; - - std::unique_ptr CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) override; - - private: - // Non-owning pointer. - content::BrowserPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(ChromeBrowserPepperHostFactory); -}; - -} // namespace chrome - -#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_CHROME_BROWSER_PEPPER_HOST_FACTORY_H_ diff --git a/chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.h b/chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.h deleted file mode 100644 index cc10ee85780c..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 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 file. - -#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_MONITOR_FINDER_MAC_H_ -#define CHROME_BROWSER_RENDERER_HOST_PEPPER_MONITOR_FINDER_MAC_H_ - -#include -#include - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/synchronization/lock.h" - -namespace chrome { - -// MonitorFinder maps a RenderFrameHost to the display ID on which the widget -// is painting. This class operates on the IO thread while the RenderFrameHost -// is on the UI thread, so the value returned by GetMonitor() may be 0 until -// the information can be retrieved asynchronously. -class MonitorFinder : public base::RefCountedThreadSafe { - public: - MonitorFinder(int process_id, int render_frame_id); - - // Gets the native display ID for the tuple. - int64_t GetMonitor(); - - // Checks if the given |monitor_id| represents a built-in display. - static bool IsMonitorBuiltIn(int64_t monitor_id); - - private: - friend class base::RefCountedThreadSafe; - ~MonitorFinder(); - - // Method run on the UI thread to get the display information. - void FetchMonitorFromWidget(); - - const int process_id_; - const int render_frame_id_; - - base::Lock mutex_; // Protects the two members below. - // Whether one request to FetchMonitorFromWidget() has been made already. - bool request_sent_; - // The native display ID for the RenderFrameHost. - CGDirectDisplayID display_id_; - - DISALLOW_COPY_AND_ASSIGN(MonitorFinder); -}; - -} // namespace chrome - -#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_MONITOR_FINDER_H_ diff --git a/chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm b/chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm deleted file mode 100644 index e6e0a62fa67e..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 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 file. - -#include "chrome/browser/renderer_host/pepper/monitor_finder_mac.h" - -#import - -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_frame_host.h" - -namespace chrome { - -MonitorFinder::MonitorFinder(int process_id, int render_frame_id) - : process_id_(process_id), - render_frame_id_(render_frame_id), - request_sent_(false), - display_id_(kCGNullDirectDisplay) {} - -MonitorFinder::~MonitorFinder() {} - -int64_t MonitorFinder::GetMonitor() { - { - // The plugin may call this method several times, so avoid spamming the UI - // thread with requests by only allowing one outstanding request at a time. - base::AutoLock lock(mutex_); - if (request_sent_) - return display_id_; - request_sent_ = true; - } - - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::Bind(&MonitorFinder::FetchMonitorFromWidget, this)); - return display_id_; -} - -// static -bool MonitorFinder::IsMonitorBuiltIn(int64_t display_id) { - return CGDisplayIsBuiltin(display_id); -} - -void MonitorFinder::FetchMonitorFromWidget() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::RenderFrameHost* rfh = - content::RenderFrameHost::FromID(process_id_, render_frame_id_); - if (!rfh) - return; - - gfx::NativeView native_view = rfh->GetNativeView(); - NSWindow* window = [native_view window]; - NSScreen* screen = [window screen]; - CGDirectDisplayID display_id = - [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue]; - - base::AutoLock lock(mutex_); - request_sent_ = false; - display_id_ = display_id; -} - -} // namespace chrome diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc deleted file mode 100644 index d40ad53dd17d..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 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 file. - -#include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h" - -#include - -#include "content/public/browser/browser_ppapi_host.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_process_host.h" -#include "ipc/ipc_message_macros.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "url/gurl.h" - -using content::BrowserPpapiHost; -using content::BrowserThread; - -namespace chrome { - -PepperBrokerMessageFilter::PepperBrokerMessageFilter(PP_Instance instance, - BrowserPpapiHost* host) - : document_url_(host->GetDocumentURLForInstance(instance)) { - int unused; - host->GetRenderFrameIDsForInstance(instance, &render_process_id_, &unused); -} - -PepperBrokerMessageFilter::~PepperBrokerMessageFilter() {} - -scoped_refptr -PepperBrokerMessageFilter::OverrideTaskRunnerForMessage( - const IPC::Message& message) { - return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); -} - -int32_t PepperBrokerMessageFilter::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperBrokerMessageFilter, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Broker_IsAllowed, - OnIsAllowed) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperBrokerMessageFilter::OnIsAllowed( - ppapi::host::HostMessageContext* context) { - return PP_OK; -} - -} // namespace chrome diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h b/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h deleted file mode 100644 index 2aad5593b26a..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h +++ /dev/null @@ -1,51 +0,0 @@ -// 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 file. - -#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_BROKER_MESSAGE_FILTER_H_ -#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_BROKER_MESSAGE_FILTER_H_ - -#include "base/compiler_specific.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/host/resource_message_filter.h" -#include "url/gurl.h" - -namespace content { -class BrowserPpapiHost; -} - -namespace ppapi { -namespace host { -struct HostMessageContext; -} -} // namespace ppapi - -namespace chrome { - -// This filter handles messages for the PepperBrokerHost on the UI thread. -class PepperBrokerMessageFilter : public ppapi::host::ResourceMessageFilter { - public: - PepperBrokerMessageFilter(PP_Instance instance, - content::BrowserPpapiHost* host); - - private: - ~PepperBrokerMessageFilter() override; - - // ppapi::host::ResourceMessageFilter overrides. - scoped_refptr OverrideTaskRunnerForMessage( - const IPC::Message& message) override; - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - int32_t OnIsAllowed(ppapi::host::HostMessageContext* context); - - int render_process_id_; - GURL document_url_; - - DISALLOW_COPY_AND_ASSIGN(PepperBrokerMessageFilter); -}; - -} // namespace chrome - -#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_BROKER_MESSAGE_FILTER_H_ diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc deleted file mode 100644 index 901da1ad6e22..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc +++ /dev/null @@ -1,111 +0,0 @@ -// 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 file. - -#include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h" - -#include "base/time/time.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_process_host.h" -#include "ipc/ipc_message_macros.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/private/ppb_flash.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/resource_message_params.h" -#include "ppapi/shared_impl/time_conversion.h" -#include "url/gurl.h" - -#if defined(OS_WIN) -#include -#elif defined(OS_MACOSX) -#include -#endif - -using content::BrowserPpapiHost; -using content::BrowserThread; - -namespace chrome { - -PepperFlashBrowserHost::PepperFlashBrowserHost(BrowserPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ResourceHost(host->GetPpapiHost(), instance, resource), - host_(host), - weak_factory_(this) { - int unused; - host->GetRenderFrameIDsForInstance(instance, &render_process_id_, &unused); -} - -PepperFlashBrowserHost::~PepperFlashBrowserHost() {} - -int32_t PepperFlashBrowserHost::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashBrowserHost, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_UpdateActivity, - OnUpdateActivity) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetLocalTimeZoneOffset, - OnGetLocalTimeZoneOffset) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( - PpapiHostMsg_Flash_GetLocalDataRestrictions, OnGetLocalDataRestrictions) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashBrowserHost::OnUpdateActivity( - ppapi::host::HostMessageContext* host_context) { -#if defined(OS_WIN) - // Reading then writing back the same value to the screensaver timeout system - // setting resets the countdown which prevents the screensaver from turning - // on "for a while". As long as the plugin pings us with this message faster - // than the screensaver timeout, it won't go on. - int value = 0; - if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &value, 0)) - SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, value, NULL, 0); -#elif defined(OS_MACOSX) -// UpdateSystemActivity(OverallAct); -#else -// TODO(brettw) implement this for other platforms. -#endif - return PP_OK; -} - -int32_t PepperFlashBrowserHost::OnGetLocalTimeZoneOffset( - ppapi::host::HostMessageContext* host_context, - const base::Time& t) { - // The reason for this processing being in the browser process is that on - // Linux, the localtime calls require filesystem access prohibited by the - // sandbox. - host_context->reply_msg = PpapiPluginMsg_Flash_GetLocalTimeZoneOffsetReply( - ppapi::PPGetLocalTimeZoneOffset(t)); - return PP_OK; -} - -int32_t PepperFlashBrowserHost::OnGetLocalDataRestrictions( - ppapi::host::HostMessageContext* context) { - // Getting the Flash LSO settings requires using the CookieSettings which - // belong to the profile which lives on the UI thread. We lazily initialize - // |cookie_settings_| by grabbing the reference from the UI thread and then - // call |GetLocalDataRestrictions| with it. - GURL document_url = host_->GetDocumentURLForInstance(pp_instance()); - GURL plugin_url = host_->GetPluginURLForInstance(pp_instance()); - GetLocalDataRestrictions(context->MakeReplyMessageContext(), document_url, - plugin_url); - return PP_OK_COMPLETIONPENDING; -} - -void PepperFlashBrowserHost::GetLocalDataRestrictions( - ppapi::host::ReplyMessageContext reply_context, - const GURL& document_url, - const GURL& plugin_url) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - - PP_FlashLSORestrictions restrictions = PP_FLASHLSORESTRICTIONS_NONE; - SendReply(reply_context, PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply( - static_cast(restrictions))); -} - -} // namespace chrome diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h deleted file mode 100644 index 65e0d02c001c..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h +++ /dev/null @@ -1,59 +0,0 @@ -// 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 file. - -#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ -#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ - -#include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/resource_host.h" - -namespace base { -class Time; -} - -namespace content { -class BrowserPpapiHost; -class ResourceContext; -} // namespace content - -class GURL; - -namespace chrome { - -class PepperFlashBrowserHost : public ppapi::host::ResourceHost { - public: - PepperFlashBrowserHost(content::BrowserPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - ~PepperFlashBrowserHost() override; - - // ppapi::host::ResourceHost override. - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - private: - int32_t OnUpdateActivity(ppapi::host::HostMessageContext* host_context); - int32_t OnGetLocalTimeZoneOffset( - ppapi::host::HostMessageContext* host_context, - const base::Time& t); - int32_t OnGetLocalDataRestrictions(ppapi::host::HostMessageContext* context); - - void GetLocalDataRestrictions(ppapi::host::ReplyMessageContext reply_context, - const GURL& document_url, - const GURL& plugin_url); - - content::BrowserPpapiHost* host_; - int render_process_id_; - // For fetching the Flash LSO settings. - base::WeakPtrFactory weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHost); -}; - -} // namespace chrome - -#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc deleted file mode 100644 index c62d2d98621d..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc +++ /dev/null @@ -1,372 +0,0 @@ -// 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 file. - -#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h" - -#include - -#include "base/pickle.h" -#include "base/strings/utf_string_conversions.h" -#include "content/public/browser/browser_thread.h" -#include "ipc/ipc_message.h" -#include "ipc/ipc_message_macros.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/private/ppb_flash_clipboard.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/resource_message_params.h" -#include "ui/base/clipboard/scoped_clipboard_writer.h" - -using content::BrowserThread; - -namespace chrome { - -namespace { - -const size_t kMaxClipboardWriteSize = 1000000; - -ui::ClipboardType ConvertClipboardType(uint32_t type) { - switch (type) { - case PP_FLASH_CLIPBOARD_TYPE_STANDARD: - return ui::CLIPBOARD_TYPE_COPY_PASTE; - case PP_FLASH_CLIPBOARD_TYPE_SELECTION: - return ui::CLIPBOARD_TYPE_SELECTION; - } - NOTREACHED(); - return ui::CLIPBOARD_TYPE_COPY_PASTE; -} - -// Functions to pack/unpack custom data from a pickle. See the header file for -// more detail on custom formats in Pepper. -// TODO(raymes): Currently pepper custom formats are stored in their own -// native format type. However we should be able to store them in the same way -// as "Web Custom" formats are. This would allow clipboard data to be shared -// between pepper applications and web applications. However currently web apps -// assume all data that is placed on the clipboard is UTF16 and pepper allows -// arbitrary data so this change would require some reworking of the chrome -// clipboard interface for custom data. -bool JumpToFormatInPickle(const base::string16& format, - base::PickleIterator* iter) { - uint32_t size = 0; - if (!iter->ReadUInt32(&size)) - return false; - for (uint32_t i = 0; i < size; ++i) { - base::string16 stored_format; - if (!iter->ReadString16(&stored_format)) - return false; - if (stored_format == format) - return true; - int skip_length; - if (!iter->ReadLength(&skip_length)) - return false; - if (!iter->SkipBytes(skip_length)) - return false; - } - return false; -} - -bool IsFormatAvailableInPickle(const base::string16& format, - const base::Pickle& pickle) { - base::PickleIterator iter(pickle); - return JumpToFormatInPickle(format, &iter); -} - -std::string ReadDataFromPickle(const base::string16& format, - const base::Pickle& pickle) { - std::string result; - base::PickleIterator iter(pickle); - if (!JumpToFormatInPickle(format, &iter) || !iter.ReadString(&result)) - return std::string(); - return result; -} - -void WriteDataToPickle(const std::map& data, - base::Pickle* pickle) { - pickle->WriteUInt32(data.size()); - for (std::map::const_iterator it = data.begin(); - it != data.end(); ++it) { - pickle->WriteString16(it->first); - pickle->WriteString(it->second); - } -} - -} // namespace - -PepperFlashClipboardMessageFilter::PepperFlashClipboardMessageFilter() {} - -PepperFlashClipboardMessageFilter::~PepperFlashClipboardMessageFilter() {} - -scoped_refptr -PepperFlashClipboardMessageFilter::OverrideTaskRunnerForMessage( - const IPC::Message& msg) { - // Clipboard writes should always occur on the UI thread due to the - // restrictions of various platform APIs. In general, the clipboard is not - // thread-safe, so all clipboard calls should be serviced from the UI thread. - if (msg.type() == PpapiHostMsg_FlashClipboard_WriteData::ID) - return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); - -// Windows needs clipboard reads to be serviced from the IO thread because -// these are sync IPCs which can result in deadlocks with plugins if serviced -// from the UI thread. Note that Windows clipboard calls ARE thread-safe so it -// is ok for reads and writes to be serviced from different threads. -#if !defined(OS_WIN) - return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); -#else - return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); -#endif -} - -int32_t PepperFlashClipboardMessageFilter::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashClipboardMessageFilter, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL( - PpapiHostMsg_FlashClipboard_RegisterCustomFormat, - OnMsgRegisterCustomFormat) - PPAPI_DISPATCH_HOST_RESOURCE_CALL( - PpapiHostMsg_FlashClipboard_IsFormatAvailable, OnMsgIsFormatAvailable) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FlashClipboard_ReadData, - OnMsgReadData) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FlashClipboard_WriteData, - OnMsgWriteData) - PPAPI_DISPATCH_HOST_RESOURCE_CALL( - PpapiHostMsg_FlashClipboard_GetSequenceNumber, OnMsgGetSequenceNumber) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashClipboardMessageFilter::OnMsgRegisterCustomFormat( - ppapi::host::HostMessageContext* host_context, - const std::string& format_name) { - uint32_t format = custom_formats_.RegisterFormat(format_name); - if (format == PP_FLASH_CLIPBOARD_FORMAT_INVALID) - return PP_ERROR_FAILED; - host_context->reply_msg = - PpapiPluginMsg_FlashClipboard_RegisterCustomFormatReply(format); - return PP_OK; -} - -int32_t PepperFlashClipboardMessageFilter::OnMsgIsFormatAvailable( - ppapi::host::HostMessageContext* host_context, - uint32_t clipboard_type, - uint32_t format) { - if (clipboard_type != PP_FLASH_CLIPBOARD_TYPE_STANDARD) { - NOTIMPLEMENTED(); - return PP_ERROR_FAILED; - } - - ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); - ui::ClipboardType type = ConvertClipboardType(clipboard_type); - bool available = false; - switch (format) { - case PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT: { - bool plain = clipboard->IsFormatAvailable( - ui::Clipboard::GetPlainTextFormatType(), type); - bool plainw = clipboard->IsFormatAvailable( - ui::Clipboard::GetPlainTextWFormatType(), type); - available = plain || plainw; - break; - } - case PP_FLASH_CLIPBOARD_FORMAT_HTML: - available = clipboard->IsFormatAvailable( - ui::Clipboard::GetHtmlFormatType(), type); - break; - case PP_FLASH_CLIPBOARD_FORMAT_RTF: - available = - clipboard->IsFormatAvailable(ui::Clipboard::GetRtfFormatType(), type); - break; - case PP_FLASH_CLIPBOARD_FORMAT_INVALID: - break; - default: - if (custom_formats_.IsFormatRegistered(format)) { - std::string format_name = custom_formats_.GetFormatName(format); - std::string clipboard_data; - clipboard->ReadData(ui::Clipboard::GetPepperCustomDataFormatType(), - &clipboard_data); - base::Pickle pickle(clipboard_data.data(), clipboard_data.size()); - available = - IsFormatAvailableInPickle(base::UTF8ToUTF16(format_name), pickle); - } - break; - } - - return available ? PP_OK : PP_ERROR_FAILED; -} - -int32_t PepperFlashClipboardMessageFilter::OnMsgReadData( - ppapi::host::HostMessageContext* host_context, - uint32_t clipboard_type, - uint32_t format) { - if (clipboard_type != PP_FLASH_CLIPBOARD_TYPE_STANDARD) { - NOTIMPLEMENTED(); - return PP_ERROR_FAILED; - } - - ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); - ui::ClipboardType type = ConvertClipboardType(clipboard_type); - std::string clipboard_string; - int32_t result = PP_ERROR_FAILED; - switch (format) { - case PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT: { - if (clipboard->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), - type)) { - base::string16 text; - clipboard->ReadText(type, &text); - if (!text.empty()) { - result = PP_OK; - clipboard_string = base::UTF16ToUTF8(text); - break; - } - } - // If the PlainTextW format isn't available or is empty, take the - // ASCII text format. - if (clipboard->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), - type)) { - result = PP_OK; - clipboard->ReadAsciiText(type, &clipboard_string); - } - break; - } - case PP_FLASH_CLIPBOARD_FORMAT_HTML: { - if (!clipboard->IsFormatAvailable(ui::Clipboard::GetHtmlFormatType(), - type)) { - break; - } - - base::string16 html; - std::string url; - uint32_t fragment_start; - uint32_t fragment_end; - clipboard->ReadHTML(type, &html, &url, &fragment_start, &fragment_end); - result = PP_OK; - clipboard_string = base::UTF16ToUTF8( - html.substr(fragment_start, fragment_end - fragment_start)); - break; - } - case PP_FLASH_CLIPBOARD_FORMAT_RTF: { - if (!clipboard->IsFormatAvailable(ui::Clipboard::GetRtfFormatType(), - type)) { - break; - } - result = PP_OK; - clipboard->ReadRTF(type, &clipboard_string); - break; - } - case PP_FLASH_CLIPBOARD_FORMAT_INVALID: - break; - default: { - if (custom_formats_.IsFormatRegistered(format)) { - base::string16 format_name = - base::UTF8ToUTF16(custom_formats_.GetFormatName(format)); - std::string clipboard_data; - clipboard->ReadData(ui::Clipboard::GetPepperCustomDataFormatType(), - &clipboard_data); - base::Pickle pickle(clipboard_data.data(), clipboard_data.size()); - if (IsFormatAvailableInPickle(format_name, pickle)) { - result = PP_OK; - clipboard_string = ReadDataFromPickle(format_name, pickle); - } - } - break; - } - } - - if (result == PP_OK) { - host_context->reply_msg = - PpapiPluginMsg_FlashClipboard_ReadDataReply(clipboard_string); - } - return result; -} - -int32_t PepperFlashClipboardMessageFilter::OnMsgWriteData( - ppapi::host::HostMessageContext* host_context, - uint32_t clipboard_type, - const std::vector& formats, - const std::vector& data) { - if (clipboard_type != PP_FLASH_CLIPBOARD_TYPE_STANDARD) { - NOTIMPLEMENTED(); - return PP_ERROR_FAILED; - } - if (formats.size() != data.size()) - return PP_ERROR_FAILED; - - ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); - ui::ClipboardType type = ConvertClipboardType(clipboard_type); - // If no formats are passed in clear the clipboard. - if (formats.size() == 0) { - clipboard->Clear(type); - return PP_OK; - } - - ui::ScopedClipboardWriter scw(type); - std::map custom_data_map; - int32_t res = PP_OK; - for (uint32_t i = 0; i < formats.size(); ++i) { - if (data[i].length() > kMaxClipboardWriteSize) { - res = PP_ERROR_NOSPACE; - break; - } - - switch (formats[i]) { - case PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT: - scw.WriteText(base::UTF8ToUTF16(data[i])); - break; - case PP_FLASH_CLIPBOARD_FORMAT_HTML: - scw.WriteHTML(base::UTF8ToUTF16(data[i]), std::string()); - break; - case PP_FLASH_CLIPBOARD_FORMAT_RTF: - scw.WriteRTF(data[i]); - break; - case PP_FLASH_CLIPBOARD_FORMAT_INVALID: - res = PP_ERROR_BADARGUMENT; - break; - default: - if (custom_formats_.IsFormatRegistered(formats[i])) { - std::string format_name = custom_formats_.GetFormatName(formats[i]); - custom_data_map[base::UTF8ToUTF16(format_name)] = data[i]; - } else { - // Invalid format. - res = PP_ERROR_BADARGUMENT; - break; - } - } - - if (res != PP_OK) - break; - } - - if (custom_data_map.size() > 0) { - base::Pickle pickle; - WriteDataToPickle(custom_data_map, &pickle); - scw.WritePickledData(pickle, - ui::Clipboard::GetPepperCustomDataFormatType()); - } - - if (res != PP_OK) { - // Need to clear the objects so nothing is written. - scw.Reset(); - } - - return res; -} - -int32_t PepperFlashClipboardMessageFilter::OnMsgGetSequenceNumber( - ppapi::host::HostMessageContext* host_context, - uint32_t clipboard_type) { - if (clipboard_type != PP_FLASH_CLIPBOARD_TYPE_STANDARD) { - NOTIMPLEMENTED(); - return PP_ERROR_FAILED; - } - - ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); - ui::ClipboardType type = ConvertClipboardType(clipboard_type); - int64_t sequence_number = clipboard->GetSequenceNumber(type); - host_context->reply_msg = - PpapiPluginMsg_FlashClipboard_GetSequenceNumberReply(sequence_number); - return PP_OK; -} - -} // namespace chrome diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h deleted file mode 100644 index b282d54df28c..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h +++ /dev/null @@ -1,76 +0,0 @@ -// 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 file. - -#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_CLIPBOARD_MESSAGE_FILTER_H_ -#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_CLIPBOARD_MESSAGE_FILTER_H_ - -#include -#include - -#include "ppapi/host/resource_message_filter.h" -#include "ppapi/shared_impl/flash_clipboard_format_registry.h" - -namespace ppapi { -namespace host { -struct HostMessageContext; -} -} // namespace ppapi - -namespace ui { -class ScopedClipboardWriter; -} - -namespace chrome { - -// Resource message filter for accessing the clipboard in Pepper. Pepper -// supports reading/writing custom formats from the clipboard. Currently, all -// custom formats that are read/written from the clipboard through pepper are -// stored in a single real clipboard format (in the same way the "web custom" -// clipboard formats are). This is done so that we don't have to have use real -// clipboard types for each custom clipboard format which may be a limited -// resource on a particular platform. -class PepperFlashClipboardMessageFilter - : public ppapi::host::ResourceMessageFilter { - public: - PepperFlashClipboardMessageFilter(); - - protected: - // ppapi::host::ResourceMessageFilter overrides. - scoped_refptr OverrideTaskRunnerForMessage( - const IPC::Message& msg) override; - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - private: - ~PepperFlashClipboardMessageFilter() override; - - int32_t OnMsgRegisterCustomFormat( - ppapi::host::HostMessageContext* host_context, - const std::string& format_name); - int32_t OnMsgIsFormatAvailable(ppapi::host::HostMessageContext* host_context, - uint32_t clipboard_type, - uint32_t format); - int32_t OnMsgReadData(ppapi::host::HostMessageContext* host_context, - uint32_t clipoard_type, - uint32_t format); - int32_t OnMsgWriteData(ppapi::host::HostMessageContext* host_context, - uint32_t clipboard_type, - const std::vector& formats, - const std::vector& data); - int32_t OnMsgGetSequenceNumber(ppapi::host::HostMessageContext* host_context, - uint32_t clipboard_type); - - int32_t WriteClipboardDataItem(uint32_t format, - const std::string& data, - ui::ScopedClipboardWriter* scw); - - ppapi::FlashClipboardFormatRegistry custom_formats_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashClipboardMessageFilter); -}; - -} // namespace chrome - -#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_CLIPBOARD_MESSAGE_FILTER_H_ diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc deleted file mode 100644 index 06b0b583a644..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc +++ /dev/null @@ -1,216 +0,0 @@ -// 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 file. - -#include "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h" - -#include - -#if defined(OS_WIN) -#include -#endif - -#include "base/bind.h" -#include "base/compiler_specific.h" -#include "base/logging.h" -#include "base/memory/ref_counted.h" -#include "base/strings/string_number_conversions.h" -#include "build/build_config.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/child_process_security_policy.h" -#include "content/public/browser/render_frame_host.h" -#include "content/public/common/pepper_plugin_info.h" -#include "net/base/network_interfaces.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" - -#if defined(USE_AURA) -#include "ui/aura/window.h" -#include "ui/aura/window_tree_host.h" -#endif - -#if defined(OS_MACOSX) -#include "chrome/browser/renderer_host/pepper/monitor_finder_mac.h" -#endif - -using content::BrowserPpapiHost; - -namespace chrome { - -namespace { - -const char kVoucherFilename[] = "plugin.vch"; - -#if defined(OS_WIN) -bool GetSystemVolumeSerialNumber(std::string* number) { - // Find the system root path (e.g: C:\). - wchar_t system_path[MAX_PATH + 1]; - if (!GetSystemDirectoryW(system_path, MAX_PATH)) - return false; - - wchar_t* first_slash = wcspbrk(system_path, L"\\/"); - if (first_slash != NULL) - *(first_slash + 1) = 0; - - DWORD number_local = 0; - if (!GetVolumeInformationW(system_path, NULL, 0, &number_local, NULL, NULL, - NULL, 0)) - return false; - - *number = base::IntToString(std::abs(static_cast(number_local))); - return true; -} -#endif - -} // namespace - -#if defined(OS_WIN) -// Helper class to get the UI thread which monitor is showing the -// window associated with the instance's render view. Since we get -// called by the IO thread and we cannot block, the first answer is -// of GetMonitor() may be NULL, but eventually it will contain the -// right monitor. -class MonitorFinder : public base::RefCountedThreadSafe { - public: - MonitorFinder(int process_id, int render_frame_id) - : process_id_(process_id), - render_frame_id_(render_frame_id), - monitor_(NULL), - request_sent_(0) {} - - int64_t GetMonitor() { - // We use |request_sent_| as an atomic boolean so that we - // never have more than one task posted at a given time. We - // do this because we don't know how often our client is going - // to call and we can't cache the |monitor_| value. - if (InterlockedCompareExchange(&request_sent_, 1, 0) == 0) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::Bind(&MonitorFinder::FetchMonitorFromWidget, this)); - } - return reinterpret_cast(monitor_); - } - - private: - friend class base::RefCountedThreadSafe; - ~MonitorFinder() {} - - void FetchMonitorFromWidget() { - InterlockedExchange(&request_sent_, 0); - content::RenderFrameHost* rfh = - content::RenderFrameHost::FromID(process_id_, render_frame_id_); - if (!rfh) - return; - gfx::NativeView native_view = rfh->GetNativeView(); -#if defined(USE_AURA) - aura::WindowTreeHost* host = native_view->GetHost(); - if (!host) - return; - HWND window = host->GetAcceleratedWidget(); -#else - HWND window = native_view; -#endif - HMONITOR monitor = ::MonitorFromWindow(window, MONITOR_DEFAULTTONULL); - InterlockedExchangePointer(reinterpret_cast(&monitor_), - monitor); - } - - const int process_id_; - const int render_frame_id_; - volatile HMONITOR monitor_; - volatile long request_sent_; -}; -#elif !defined(OS_MACOSX) -// TODO(cpu): Support Linux someday. -class MonitorFinder : public base::RefCountedThreadSafe { - public: - MonitorFinder(int, int) {} - int64_t GetMonitor() { return 0; } - - private: - friend class base::RefCountedThreadSafe; - ~MonitorFinder() {} -}; -#endif - -PepperFlashDRMHost::PepperFlashDRMHost(BrowserPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ppapi::host::ResourceHost(host->GetPpapiHost(), instance, resource), - weak_factory_(this) { - // Grant permissions to read the flash voucher file. - int render_process_id; - int render_frame_id; - bool success = host->GetRenderFrameIDsForInstance( - instance, &render_process_id, &render_frame_id); - base::FilePath plugin_dir = host->GetPluginPath().DirName(); - DCHECK(!plugin_dir.empty() && success); - base::FilePath voucher_file = plugin_dir.AppendASCII(kVoucherFilename); - content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( - render_process_id, voucher_file); - - monitor_finder_ = new MonitorFinder(render_process_id, render_frame_id); - monitor_finder_->GetMonitor(); -} - -PepperFlashDRMHost::~PepperFlashDRMHost() {} - -int32_t PepperFlashDRMHost::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashDRMHost, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_GetDeviceID, - OnHostMsgGetDeviceID) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_GetHmonitor, - OnHostMsgGetHmonitor) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_MonitorIsExternal, - OnHostMsgMonitorIsExternal) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashDRMHost::OnHostMsgGetDeviceID( - ppapi::host::HostMessageContext* context) { - static std::string id; -#if defined(OS_WIN) - if (id.empty() && !GetSystemVolumeSerialNumber(&id)) - id = net::GetHostName(); -#else - if (id.empty()) - id = net::GetHostName(); -#endif - context->reply_msg = PpapiPluginMsg_FlashDRM_GetDeviceIDReply(id); - return PP_OK; -} - -int32_t PepperFlashDRMHost::OnHostMsgGetHmonitor( - ppapi::host::HostMessageContext* context) { - int64_t monitor_id = monitor_finder_->GetMonitor(); - if (monitor_id) { - context->reply_msg = PpapiPluginMsg_FlashDRM_GetHmonitorReply(monitor_id); - return PP_OK; - } - return PP_ERROR_FAILED; -} - -int32_t PepperFlashDRMHost::OnHostMsgMonitorIsExternal( - ppapi::host::HostMessageContext* context) { - int64_t monitor_id = monitor_finder_->GetMonitor(); - if (!monitor_id) - return PP_ERROR_FAILED; - - PP_Bool is_external = PP_FALSE; -#if defined(OS_MACOSX) - if (!MonitorFinder::IsMonitorBuiltIn(monitor_id)) - is_external = PP_TRUE; -#endif - context->reply_msg = - PpapiPluginMsg_FlashDRM_MonitorIsExternalReply(is_external); - return PP_OK; -} - -} // namespace chrome diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h deleted file mode 100644 index 91bba9631e68..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2013 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 file. - -#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_ -#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_ - -#include - -#include - -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/resource_host.h" - -namespace content { -class BrowserPpapiHost; -} - -namespace IPC { -class Message; -} - -namespace chrome { -class MonitorFinder; - -class PepperFlashDRMHost : public ppapi::host::ResourceHost { - public: - PepperFlashDRMHost(content::BrowserPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - ~PepperFlashDRMHost() override; - - // ResourceHost override. - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - private: - // IPC message handler. - int32_t OnHostMsgGetDeviceID(ppapi::host::HostMessageContext* context); - int32_t OnHostMsgGetHmonitor(ppapi::host::HostMessageContext* context); - int32_t OnHostMsgMonitorIsExternal(ppapi::host::HostMessageContext* context); - - scoped_refptr monitor_finder_; - - base::WeakPtrFactory weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashDRMHost); -}; - -} // namespace chrome - -#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_ diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc deleted file mode 100644 index be771653066b..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2013 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 file. - -#include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h" - -#include "content/public/browser/browser_ppapi_host.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/child_process_security_policy.h" -#include "content/public/browser/render_view_host.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/file_system_util.h" -#include "storage/browser/fileapi/isolated_context.h" - -namespace chrome { - -// static -PepperIsolatedFileSystemMessageFilter* -PepperIsolatedFileSystemMessageFilter::Create(PP_Instance instance, - content::BrowserPpapiHost* host) { - int render_process_id; - int unused_render_frame_id; - if (!host->GetRenderFrameIDsForInstance(instance, &render_process_id, - &unused_render_frame_id)) { - return NULL; - } - return new PepperIsolatedFileSystemMessageFilter( - render_process_id, host->GetProfileDataDirectory(), - host->GetDocumentURLForInstance(instance), host->GetPpapiHost()); -} - -PepperIsolatedFileSystemMessageFilter::PepperIsolatedFileSystemMessageFilter( - int render_process_id, - const base::FilePath& profile_directory, - const GURL& document_url, - ppapi::host::PpapiHost* ppapi_host) - : render_process_id_(render_process_id), - profile_directory_(profile_directory), - document_url_(document_url), - ppapi_host_(ppapi_host) {} - -PepperIsolatedFileSystemMessageFilter:: - ~PepperIsolatedFileSystemMessageFilter() {} - -scoped_refptr -PepperIsolatedFileSystemMessageFilter::OverrideTaskRunnerForMessage( - const IPC::Message& msg) { - // In order to reach ExtensionSystem, we need to get ProfileManager first. - // ProfileManager lives in UI thread, so we need to do this in UI thread. - return content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::UI); -} - -int32_t PepperIsolatedFileSystemMessageFilter::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperIsolatedFileSystemMessageFilter, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL( - PpapiHostMsg_IsolatedFileSystem_BrowserOpen, OnOpenFileSystem) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( - ppapi::host::HostMessageContext* context, - PP_IsolatedFileSystemType_Private type) { - switch (type) { - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID: - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX: - break; - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE: - return OpenPluginPrivateFileSystem(context); - } - NOTREACHED(); - context->reply_msg = - PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(std::string()); - return PP_ERROR_FAILED; -} - -int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem( - ppapi::host::HostMessageContext* context) { - DCHECK(ppapi_host_); - // Only plugins with private permission can open the filesystem. - if (!ppapi_host_->permissions().HasPermission(ppapi::PERMISSION_PRIVATE)) - return PP_ERROR_NOACCESS; - - const std::string& root_name = ppapi::IsolatedFileSystemTypeToRootName( - PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE); - const std::string& fsid = - storage::IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath( - storage::kFileSystemTypePluginPrivate, root_name, base::FilePath()); - - // Grant full access of isolated filesystem to renderer process. - content::ChildProcessSecurityPolicy* policy = - content::ChildProcessSecurityPolicy::GetInstance(); - policy->GrantCreateReadWriteFileSystem(render_process_id_, fsid); - - context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid); - return PP_OK; -} - -} // namespace chrome diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h b/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h deleted file mode 100644 index 6a24feadd150..000000000000 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2013 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 file. - -#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H_ -#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H_ - -#include -#include - -#include "base/files/file_path.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/private/ppb_isolated_file_system_private.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/host/resource_message_filter.h" -#include "url/gurl.h" - -class Profile; - -namespace content { -class BrowserPpapiHost; -} - -namespace ppapi { -namespace host { -struct HostMessageContext; -} // namespace host -} // namespace ppapi - -namespace chrome { - -class PepperIsolatedFileSystemMessageFilter - : public ppapi::host::ResourceMessageFilter { - public: - static PepperIsolatedFileSystemMessageFilter* Create( - PP_Instance instance, - content::BrowserPpapiHost* host); - - // ppapi::host::ResourceMessageFilter implementation. - scoped_refptr OverrideTaskRunnerForMessage( - const IPC::Message& msg) override; - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - private: - PepperIsolatedFileSystemMessageFilter(int render_process_id, - const base::FilePath& profile_directory, - const GURL& document_url, - ppapi::host::PpapiHost* ppapi_host_); - - ~PepperIsolatedFileSystemMessageFilter() override; - - // Returns filesystem id of isolated filesystem if valid, or empty string - // otherwise. This must run on the UI thread because ProfileManager only - // allows access on that thread. - - int32_t OnOpenFileSystem(ppapi::host::HostMessageContext* context, - PP_IsolatedFileSystemType_Private type); - int32_t OpenPluginPrivateFileSystem(ppapi::host::HostMessageContext* context); - - const int render_process_id_; - // Keep a copy from original thread. - const base::FilePath profile_directory_; - const GURL document_url_; - - // Not owned by this object. - ppapi::host::PpapiHost* ppapi_host_; - - DISALLOW_COPY_AND_ASSIGN(PepperIsolatedFileSystemMessageFilter); -}; - -} // namespace chrome - -#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H_ diff --git a/chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc b/chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc deleted file mode 100644 index 437d87f8ff5e..000000000000 --- a/chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc +++ /dev/null @@ -1,99 +0,0 @@ -// 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 file. - -#include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h" - -#include "base/logging.h" -#include "chrome/renderer/pepper/pepper_flash_font_file_host.h" -#include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h" -#include "chrome/renderer/pepper/pepper_flash_menu_host.h" -#include "chrome/renderer/pepper/pepper_flash_renderer_host.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/proxy/ppapi_message_utils.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/ppapi_permissions.h" - -#if defined(ENABLE_PDF_VIEWER) -#include "components/pdf/renderer/pepper_pdf_host.h" -#endif // defined(ENABLE_PDF_VIEWER) - -using ppapi::host::ResourceHost; - -ChromeRendererPepperHostFactory::ChromeRendererPepperHostFactory( - content::RendererPpapiHost* host) - : host_(host) {} - -ChromeRendererPepperHostFactory::~ChromeRendererPepperHostFactory() {} - -std::unique_ptr -ChromeRendererPepperHostFactory::CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) { - DCHECK_EQ(host_->GetPpapiHost(), host); - - // Make sure the plugin is giving us a valid instance for this resource. - if (!host_->IsValidInstance(instance)) - return std::unique_ptr(); - - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_FLASH)) { - switch (message.type()) { - case PpapiHostMsg_Flash_Create::ID: { - return std::unique_ptr( - new PepperFlashRendererHost(host_, instance, resource)); - } - case PpapiHostMsg_FlashFullscreen_Create::ID: { - return std::unique_ptr( - new PepperFlashFullscreenHost(host_, instance, resource)); - } - case PpapiHostMsg_FlashMenu_Create::ID: { - ppapi::proxy::SerializedFlashMenu serialized_menu; - if (ppapi::UnpackMessage( - message, &serialized_menu)) { - return std::unique_ptr(new PepperFlashMenuHost( - host_, instance, resource, serialized_menu)); - } - 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. - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_FLASH) || - host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_PRIVATE)) { - switch (message.type()) { - case PpapiHostMsg_FlashFontFile_Create::ID: { - ppapi::proxy::SerializedFontDescription description; - PP_PrivateFontCharset charset; - if (ppapi::UnpackMessage( - message, &description, &charset)) { - return std::unique_ptr(new PepperFlashFontFileHost( - host_, instance, resource, description, charset)); - } - break; - } - } - } - -#if defined(ENABLE_PDF_VIEWER) - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_PRIVATE)) { - switch (message.type()) { - case PpapiHostMsg_PDF_Create::ID: { - return std::make_unique(host_, instance, resource); - } - } - } -#endif // defined(ENABLE_PDF_VIEWER) - - return std::unique_ptr(); -} diff --git a/chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h b/chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h deleted file mode 100644 index c52c73b56f04..000000000000 --- a/chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h +++ /dev/null @@ -1,34 +0,0 @@ -// 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 file. - -#ifndef CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_ -#define CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_ - -#include "base/macros.h" -#include "ppapi/host/host_factory.h" - -namespace content { -class RendererPpapiHost; -} - -class ChromeRendererPepperHostFactory : public ppapi::host::HostFactory { - public: - explicit ChromeRendererPepperHostFactory(content::RendererPpapiHost* host); - ~ChromeRendererPepperHostFactory() override; - - // HostFactory. - std::unique_ptr CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) override; - - private: - // Not owned by this object. - content::RendererPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(ChromeRendererPepperHostFactory); -}; - -#endif // CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_ diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc b/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc deleted file mode 100644 index efdc9316b829..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc +++ /dev/null @@ -1,105 +0,0 @@ -// 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 file. - -#include "chrome/renderer/pepper/pepper_flash_font_file_host.h" - -#include "base/sys_byteorder.h" -#include "build/build_config.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/serialized_structs.h" - -#if defined(OS_LINUX) || defined(OS_OPENBSD) -#include "content/public/child/child_process_sandbox_support_linux.h" -#include "content/public/common/common_sandbox_support_linux.h" -#elif defined(OS_WIN) -#include "third_party/skia/include/ports/SkFontMgr.h" -#endif - -PepperFlashFontFileHost::PepperFlashFontFileHost( - content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource, - const ppapi::proxy::SerializedFontDescription& description, - PP_PrivateFontCharset charset) - : ResourceHost(host->GetPpapiHost(), instance, resource) { -#if defined(OS_LINUX) || defined(OS_OPENBSD) - fd_.reset(content::MatchFontWithFallback( - description.face.c_str(), - description.weight >= PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD, - description.italic, charset, PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT)); -#elif defined(OS_WIN) // defined(OS_LINUX) || defined(OS_OPENBSD) - int weight = description.weight; - if (weight == FW_DONTCARE) - weight = SkFontStyle::kNormal_Weight; - SkFontStyle style(weight, SkFontStyle::kNormal_Width, - description.italic ? SkFontStyle::kItalic_Slant - : SkFontStyle::kUpright_Slant); - sk_sp font_mgr(SkFontMgr::RefDefault()); - typeface_ = sk_sp( - font_mgr->matchFamilyStyle(description.face.c_str(), style)); -#endif // defined(OS_WIN) -} - -PepperFlashFontFileHost::~PepperFlashFontFileHost() {} - -int32_t PepperFlashFontFileHost::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashFontFileHost, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FlashFontFile_GetFontTable, - OnGetFontTable) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} -bool PepperFlashFontFileHost::GetFontData(uint32_t table, - void* buffer, - size_t* length) { - bool result = false; -#if defined(OS_LINUX) || defined(OS_OPENBSD) - int fd = fd_.get(); - if (fd != -1) - result = content::GetFontTable(fd, table, 0 /* offset */, - reinterpret_cast(buffer), length); -#elif defined(OS_WIN) - if (typeface_) { - table = base::ByteSwap(table); - if (buffer == NULL) { - *length = typeface_->getTableSize(table); - if (*length > 0) - result = true; - } else { - size_t new_length = typeface_->getTableData(table, 0, *length, buffer); - if (new_length == *length) - result = true; - } - } -#endif - return result; -} - -int32_t PepperFlashFontFileHost::OnGetFontTable( - ppapi::host::HostMessageContext* context, - uint32_t table) { - std::string contents; - int32_t result = PP_ERROR_FAILED; - size_t length = 0; - if (GetFontData(table, NULL, &length)) { - contents.resize(length); - uint8_t* contents_ptr = - reinterpret_cast(const_cast(contents.c_str())); - if (GetFontData(table, contents_ptr, &length)) { - result = PP_OK; - } else { - contents.clear(); - } - } - - context->reply_msg = PpapiPluginMsg_FlashFontFile_GetFontTableReply(contents); - return result; -} diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.h b/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.h deleted file mode 100644 index 15eb73837b50..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.h +++ /dev/null @@ -1,56 +0,0 @@ -// 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 file. - -#ifndef CHROME_RENDERER_PEPPER_PEPPER_FLASH_FONT_FILE_HOST_H_ -#define CHROME_RENDERER_PEPPER_PEPPER_FLASH_FONT_FILE_HOST_H_ - -#include "ppapi/c/private/pp_private_font_charset.h" -#include "ppapi/host/resource_host.h" - -#if defined(OS_LINUX) || defined(OS_OPENBSD) -#include "base/files/scoped_file.h" -#elif defined(OS_WIN) -#include "third_party/skia/include/core/SkRefCnt.h" -#include "third_party/skia/include/core/SkTypeface.h" -#endif - -namespace content { -class RendererPpapiHost; -} - -namespace ppapi { -namespace proxy { -struct SerializedFontDescription; -} -} // namespace ppapi - -class PepperFlashFontFileHost : public ppapi::host::ResourceHost { - public: - PepperFlashFontFileHost( - content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource, - const ppapi::proxy::SerializedFontDescription& description, - PP_PrivateFontCharset charset); - ~PepperFlashFontFileHost() override; - - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - private: - int32_t OnGetFontTable(ppapi::host::HostMessageContext* context, - uint32_t table); - bool GetFontData(uint32_t table, void* buffer, size_t* length); - -#if defined(OS_LINUX) || defined(OS_OPENBSD) - base::ScopedFD fd_; -#elif defined(OS_WIN) - sk_sp typeface_; -#endif - - DISALLOW_COPY_AND_ASSIGN(PepperFlashFontFileHost); -}; - -#endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_FONT_FILE_HOST_H_ diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc b/chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc deleted file mode 100644 index f4367ef73ce8..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc +++ /dev/null @@ -1,42 +0,0 @@ -// 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 file. - -#include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h" - -#include "content/public/renderer/pepper_plugin_instance.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" - -PepperFlashFullscreenHost::PepperFlashFullscreenHost( - content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ResourceHost(host->GetPpapiHost(), instance, resource), - renderer_ppapi_host_(host) {} - -PepperFlashFullscreenHost::~PepperFlashFullscreenHost() {} - -int32_t PepperFlashFullscreenHost::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashFullscreenHost, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL( - PpapiHostMsg_FlashFullscreen_SetFullscreen, OnSetFullscreen) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashFullscreenHost::OnSetFullscreen( - ppapi::host::HostMessageContext* context, - bool fullscreen) { - content::PepperPluginInstance* plugin_instance = - renderer_ppapi_host_->GetPluginInstance(pp_instance()); - if (plugin_instance && plugin_instance->FlashSetFullscreen(fullscreen, true)) - return PP_OK; - return PP_ERROR_FAILED; -} diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.h b/chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.h deleted file mode 100644 index 86d0af73aee5..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.h +++ /dev/null @@ -1,35 +0,0 @@ -// 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 file. - -#ifndef CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ -#define CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ - -#include "ppapi/host/resource_host.h" - -namespace content { -class RendererPpapiHost; -} - -class PepperFlashFullscreenHost : public ppapi::host::ResourceHost { - public: - PepperFlashFullscreenHost(content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - ~PepperFlashFullscreenHost() override; - - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - private: - int32_t OnSetFullscreen(ppapi::host::HostMessageContext* context, - bool fullscreen); - - // Non-owning pointer. - content::RendererPpapiHost* renderer_ppapi_host_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashFullscreenHost); -}; - -#endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.cc b/chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.cc deleted file mode 100644 index 45a79349a1c5..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.cc +++ /dev/null @@ -1,201 +0,0 @@ -// 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 file. - -#include "chrome/renderer/pepper/pepper_flash_menu_host.h" - -#include "base/strings/utf_string_conversions.h" -#include "content/public/common/context_menu_params.h" -#include "content/public/renderer/render_frame.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ipc/ipc_message.h" -#include "ppapi/c/private/ppb_flash_menu.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/serialized_flash_menu.h" -#include "ui/gfx/geometry/point.h" - -namespace { - -// Maximum depth of submenus allowed (e.g., 1 indicates that submenus are -// allowed, but not sub-submenus). -const size_t kMaxMenuDepth = 2; - -// Maximum number of entries in any single menu (including separators). -const size_t kMaxMenuEntries = 50; - -// Maximum total number of entries in the |menu_id_map| (see below). -// (Limit to 500 real entries; reserve the 0 action as an invalid entry.) -const size_t kMaxMenuIdMapEntries = 501; - -// Converts menu data from one form to another. -// - |depth| is the current nested depth (call it starting with 0). -// - |menu_id_map| is such that |menu_id_map[output_item.action] == -// input_item.id| (where |action| is what a |MenuItem| has, |id| is what a -// |PP_Flash_MenuItem| has). -bool ConvertMenuData(const PP_Flash_Menu* in_menu, - size_t depth, - std::vector* out_menu, - std::vector* menu_id_map) { - if (depth > kMaxMenuDepth || !in_menu) - return false; - - // Clear the output, just in case. - out_menu->clear(); - - if (!in_menu->count) - return true; // Nothing else to do. - - if (!in_menu->items || in_menu->count > kMaxMenuEntries) - return false; - for (uint32_t i = 0; i < in_menu->count; i++) { - content::MenuItem item; - - PP_Flash_MenuItem_Type type = in_menu->items[i].type; - switch (type) { - case PP_FLASH_MENUITEM_TYPE_NORMAL: - item.type = content::MenuItem::OPTION; - break; - case PP_FLASH_MENUITEM_TYPE_CHECKBOX: - item.type = content::MenuItem::CHECKABLE_OPTION; - break; - case PP_FLASH_MENUITEM_TYPE_SEPARATOR: - item.type = content::MenuItem::SEPARATOR; - break; - case PP_FLASH_MENUITEM_TYPE_SUBMENU: - item.type = content::MenuItem::SUBMENU; - break; - default: - return false; - } - if (in_menu->items[i].name) - item.label = base::UTF8ToUTF16(in_menu->items[i].name); - if (menu_id_map->size() >= kMaxMenuIdMapEntries) - return false; - item.action = static_cast(menu_id_map->size()); - // This sets |(*menu_id_map)[item.action] = in_menu->items[i].id|. - menu_id_map->push_back(in_menu->items[i].id); - item.enabled = PP_ToBool(in_menu->items[i].enabled); - item.checked = PP_ToBool(in_menu->items[i].checked); - if (type == PP_FLASH_MENUITEM_TYPE_SUBMENU) { - if (!ConvertMenuData(in_menu->items[i].submenu, depth + 1, &item.submenu, - menu_id_map)) - return false; - } - - out_menu->push_back(item); - } - - return true; -} - -} // namespace - -PepperFlashMenuHost::PepperFlashMenuHost( - content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource, - const ppapi::proxy::SerializedFlashMenu& serial_menu) - : ppapi::host::ResourceHost(host->GetPpapiHost(), instance, resource), - renderer_ppapi_host_(host), - showing_context_menu_(false), - context_menu_request_id_(0), - has_saved_context_menu_action_(false), - saved_context_menu_action_(0) { - menu_id_map_.push_back(0); // Reserve |menu_id_map_[0]|. - if (!ConvertMenuData(serial_menu.pp_menu(), 0, &menu_data_, &menu_id_map_)) { - menu_data_.clear(); - menu_id_map_.clear(); - } -} - -PepperFlashMenuHost::~PepperFlashMenuHost() { - if (showing_context_menu_) { - content::RenderFrame* render_frame = - renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance()); - if (render_frame) - render_frame->CancelContextMenu(context_menu_request_id_); - } -} - -int32_t PepperFlashMenuHost::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashMenuHost, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FlashMenu_Show, - OnHostMsgShow) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashMenuHost::OnHostMsgShow( - ppapi::host::HostMessageContext* context, - const PP_Point& location) { - // Note that all early returns must do a SendMenuReply. The sync result for - // this message isn't used, so to forward the error to the plugin, we need to - // additionally call SendMenuReply explicitly. - if (menu_data_.empty()) { - SendMenuReply(PP_ERROR_FAILED, -1); - return PP_ERROR_FAILED; - } - if (showing_context_menu_) { - SendMenuReply(PP_ERROR_INPROGRESS, -1); - return PP_ERROR_INPROGRESS; - } - - content::RenderFrame* render_frame = - renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance()); - - content::ContextMenuParams params; - params.x = location.x; - params.y = location.y; - params.custom_context.is_pepper_menu = true; - params.custom_context.render_widget_id = - renderer_ppapi_host_->GetRoutingIDForWidget(pp_instance()); - params.custom_items = menu_data_; - - // Transform the position to be in render frame's coordinates. - gfx::Point render_frame_pt = renderer_ppapi_host_->PluginPointToRenderFrame( - pp_instance(), gfx::Point(location.x, location.y)); - params.x = render_frame_pt.x(); - params.y = render_frame_pt.y(); - - showing_context_menu_ = true; - context_menu_request_id_ = render_frame->ShowContextMenu(this, params); - - // Note: the show message is sync so this OK is for the sync reply which we - // don't actually use (see the comment in the resource file for this). The - // async message containing the context menu action will be sent in the - // future. - return PP_OK; -} - -void PepperFlashMenuHost::OnMenuAction(int request_id, unsigned action) { - // Just save the action. - DCHECK(!has_saved_context_menu_action_); - has_saved_context_menu_action_ = true; - saved_context_menu_action_ = action; -} - -void PepperFlashMenuHost::OnMenuClosed(int request_id) { - if (has_saved_context_menu_action_ && - saved_context_menu_action_ < menu_id_map_.size()) { - SendMenuReply(PP_OK, menu_id_map_[saved_context_menu_action_]); - has_saved_context_menu_action_ = false; - saved_context_menu_action_ = 0; - } else { - SendMenuReply(PP_ERROR_USERCANCEL, -1); - } - - showing_context_menu_ = false; - context_menu_request_id_ = 0; -} - -void PepperFlashMenuHost::SendMenuReply(int32_t result, int action) { - ppapi::host::ReplyMessageContext reply_context( - ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0), NULL, - MSG_ROUTING_NONE); - reply_context.params.set_result(result); - host()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(action)); -} diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.h b/chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.h deleted file mode 100644 index a2b4f9cb4009..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.h +++ /dev/null @@ -1,69 +0,0 @@ -// 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 file. - -#ifndef CHROME_RENDERER_PEPPER_PEPPER_FLASH_MENU_HOST_H_ -#define CHROME_RENDERER_PEPPER_PEPPER_FLASH_MENU_HOST_H_ - -#include - -#include "base/compiler_specific.h" -#include "content/public/renderer/context_menu_client.h" -#include "ppapi/c/pp_point.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/resource_host.h" - -namespace content { -class RendererPpapiHost; -struct MenuItem; -} // namespace content - -namespace ppapi { -namespace proxy { -class SerializedFlashMenu; -} -} // namespace ppapi - -class PepperFlashMenuHost : public ppapi::host::ResourceHost, - public content::ContextMenuClient { - public: - PepperFlashMenuHost(content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource, - const ppapi::proxy::SerializedFlashMenu& serial_menu); - ~PepperFlashMenuHost() override; - - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - - private: - int32_t OnHostMsgShow(ppapi::host::HostMessageContext* context, - const PP_Point& location); - - // ContextMenuClient implementation. - void OnMenuAction(int request_id, unsigned action) override; - void OnMenuClosed(int request_id) override; - - void SendMenuReply(int32_t result, int action); - - content::RendererPpapiHost* renderer_ppapi_host_; - - bool showing_context_menu_; - int context_menu_request_id_; - - std::vector menu_data_; - - // We send |MenuItem|s, which have an |unsigned| "action" field instead of - // an |int32_t| ID. (CONTENT also limits the range of valid values for - // actions.) This maps actions to IDs. - std::vector menu_id_map_; - - // Used to send a single context menu "completion" upon menu close. - bool has_saved_context_menu_action_; - unsigned saved_context_menu_action_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashMenuHost); -}; - -#endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_MENU_HOST_H_ diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc b/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc deleted file mode 100644 index 50015122ccc7..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc +++ /dev/null @@ -1,370 +0,0 @@ -// 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 file. - -#include "chrome/renderer/pepper/pepper_flash_renderer_host.h" - -#include -#include - -#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/SkFontStyle.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/SkTypeface.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>:: - 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 - -PepperFlashRendererHost::PepperFlashRendererHost( - content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ResourceHost(host->GetPpapiHost(), instance, resource), - host_(host), - weak_factory_(this) {} - -PepperFlashRendererHost::~PepperFlashRendererHost() { - // 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::reverse_iterator it; - for (it = navigate_replies_.rbegin(); it != navigate_replies_.rend(); ++it) - SendReply(*it, IPC::Message()); -} - -int32_t PepperFlashRendererHost::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashRendererHost, 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_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashRendererHost::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 PepperFlashRendererHost::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); - // Since no reply is sent for this message, it doesn't make sense to return an - // error. - return PP_OK; -} - -int32_t PepperFlashRendererHost::OnDrawGlyphs( - ppapi::host::HostMessageContext* host_context, - ppapi::proxy::PPBFlash_DrawGlyphs_Params params) { - return PP_ERROR_FAILED; - // if (params.glyph_indices.size() != params.glyph_advances.size() || - // params.glyph_indices.empty()) - // return PP_ERROR_FAILED; - // - // // Set up the typeface. - // 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 typeface( - // SkTypeface::MakeFromName(params.font_desc.face.c_str(), style)); - // if (!typeface) - // return PP_ERROR_FAILED; - // - // EnterResourceNoLock enter( - // params.image_data.host_resource(), true); - // if (enter.failed()) - // return PP_ERROR_FAILED; - // - // // Set up the canvas. - // PPB_ImageData_API* image = static_cast(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); - // - // // Convert & set the matrix. - // 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); - // paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); - // paint.setAntiAlias(true); - // paint.setHinting(SkPaint::kFull_Hinting); - // paint.setTextSize(SkIntToScalar(params.font_desc.size)); - // paint.setTypeface(std::move(typeface)); - // if (params.allow_subpixel_aa) { - // paint.setSubpixelText(true); - // paint.setLCDRenderText(true); - // } - // - // 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) { - // std::vector storage; - // storage.resize(glyph_count); - // SkPoint* sk_positions = &storage[0]; - // for (uint32_t i = 0; i < glyph_count; i++) { - // sk_positions[i].set(x, y); - // x += SkFloatToScalar(params.glyph_advances[i].x); - // y += SkFloatToScalar(params.glyph_advances[i].y); - // } - // - // canvas->drawPosText(¶ms.glyph_indices[0], glyph_count * 2, sk_positions, - // 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 PepperFlashRendererHost::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& rejected_headers = - g_rejected_headers.Get(); - if (rejected_headers.empty()) { - for (size_t i = 0; i < arraysize(kRejectedHttpRequestHeaders); ++i) - rejected_headers[kRejectedHttpRequestHeaders[i]] = - static_cast(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::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 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 PepperFlashRendererHost::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; -} diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.h b/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.h deleted file mode 100644 index b080f1d9fbf0..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.h +++ /dev/null @@ -1,68 +0,0 @@ -// 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 file. - -#ifndef CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_ -#define CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_ - -#include -#include - -#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 ppapi - -namespace content { -class RendererPpapiHost; -} - -class PepperFlashRendererHost : public ppapi::host::ResourceHost { - public: - PepperFlashRendererHost(content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - ~PepperFlashRendererHost() 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); - - // A stack of ReplyMessageContexts to track Navigate() calls which have not - // yet been replied to. - std::vector navigate_replies_; - - content::RendererPpapiHost* host_; - base::WeakPtrFactory weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHost); -}; - -#endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_ diff --git a/chromium_src/chrome/renderer/pepper/pepper_helper.cc b/chromium_src/chrome/renderer/pepper/pepper_helper.cc deleted file mode 100644 index eef18560f9e5..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_helper.cc +++ /dev/null @@ -1,30 +0,0 @@ -// 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 file. - -#include "chrome/renderer/pepper/pepper_helper.h" - -#include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h" -#include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/host/ppapi_host.h" - -PepperHelper::PepperHelper(content::RenderFrame* render_frame) - : RenderFrameObserver(render_frame) {} - -PepperHelper::~PepperHelper() {} - -void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) { - // TODO(brettw) figure out how to hook up the host factory. It needs some - // kind of filter-like system to allow dynamic additions. - host->GetPpapiHost()->AddHostFactoryFilter( - std::unique_ptr( - new ChromeRendererPepperHostFactory(host))); - host->GetPpapiHost()->AddInstanceMessageFilter( - std::unique_ptr( - new PepperSharedMemoryMessageFilter(host))); -} - -void PepperHelper::OnDestruct() { - delete this; -} diff --git a/chromium_src/chrome/renderer/pepper/pepper_helper.h b/chromium_src/chrome/renderer/pepper/pepper_helper.h deleted file mode 100644 index 6157d2c79486..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_helper.h +++ /dev/null @@ -1,26 +0,0 @@ -// 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 file. - -#ifndef CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_ -#define CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_ - -#include "base/compiler_specific.h" -#include "content/public/renderer/render_frame_observer.h" - -// This class listens for Pepper creation events from the RenderFrame and -// attaches the parts required for Chrome-specific plugin support. -class PepperHelper : public content::RenderFrameObserver { - public: - explicit PepperHelper(content::RenderFrame* render_frame); - ~PepperHelper() override; - - // RenderFrameObserver. - void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; - void OnDestruct() override; - - private: - DISALLOW_COPY_AND_ASSIGN(PepperHelper); -}; - -#endif // CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_ diff --git a/chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc b/chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc deleted file mode 100644 index fb72c2da786b..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2013 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 file. - -#include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h" - -#include - -#include "base/memory/shared_memory.h" -#include "base/process/process_handle.h" -#include "content/public/common/content_client.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 "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/var_tracker.h" - -PepperSharedMemoryMessageFilter::PepperSharedMemoryMessageFilter( - content::RendererPpapiHost* host) - : InstanceMessageFilter(host->GetPpapiHost()), host_(host) {} - -PepperSharedMemoryMessageFilter::~PepperSharedMemoryMessageFilter() {} - -bool PepperSharedMemoryMessageFilter::OnInstanceMessageReceived( - const IPC::Message& msg) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(PepperSharedMemoryMessageFilter, msg) - IPC_MESSAGE_HANDLER(PpapiHostMsg_SharedMemory_CreateSharedMemory, - OnHostMsgCreateSharedMemory) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -bool PepperSharedMemoryMessageFilter::Send(IPC::Message* msg) { - return host_->GetPpapiHost()->Send(msg); -} - -void PepperSharedMemoryMessageFilter::OnHostMsgCreateSharedMemory( - PP_Instance instance, - uint32_t size, - int* host_handle_id, - ppapi::proxy::SerializedHandle* plugin_handle) { - plugin_handle->set_null_shmem(); - *host_handle_id = -1; - std::unique_ptr shm( - content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(size)); - if (!shm.get()) - return; - - base::SharedMemoryHandle host_shm_handle = shm->handle().Duplicate(); - *host_handle_id = - content::PepperPluginInstance::Get(instance) - ->GetVarTracker() - ->TrackSharedMemoryHandle(instance, host_shm_handle, size); - - // We set auto_close to false since we need our file descriptor to - // actually be duplicated on linux. The shared memory destructor will - // close the original handle for us. - plugin_handle->set_shmem( - host_->ShareSharedMemoryHandleWithRemote(host_shm_handle), size); -} diff --git a/chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.h b/chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.h deleted file mode 100644 index d1e2dc1719e5..000000000000 --- a/chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2013 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 file. - -#ifndef CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_ -#define CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_ - -#include "ppapi/c/pp_instance.h" -#include "ppapi/host/instance_message_filter.h" - -namespace content { -class RendererPpapiHost; -} - -namespace ppapi { -namespace proxy { -class SerializedHandle; -} -} // namespace ppapi - -// Implements the backend for shared memory messages from a plugin process. -class PepperSharedMemoryMessageFilter - : public ppapi::host::InstanceMessageFilter { - public: - explicit PepperSharedMemoryMessageFilter(content::RendererPpapiHost* host); - ~PepperSharedMemoryMessageFilter() override; - - // InstanceMessageFilter: - bool OnInstanceMessageReceived(const IPC::Message& msg) override; - - bool Send(IPC::Message* msg); - - private: - // Message handlers. - void OnHostMsgCreateSharedMemory( - PP_Instance instance, - uint32_t size, - int* host_shm_handle_id, - ppapi::proxy::SerializedHandle* plugin_shm_handle); - - content::RendererPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(PepperSharedMemoryMessageFilter); -}; - -#endif // CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_ diff --git a/electron.gyp b/electron.gyp index 4080a71e8350..4e81f75b55b3 100644 --- a/electron.gyp +++ b/electron.gyp @@ -48,6 +48,11 @@ 'ENABLE_VIEW_API', ], }], # enable_view_api + ['enable_pepper_flash==1', { + 'defines': [ + 'ENABLE_PEPPER_FLASH', + ], + }], # enable_pepper_flash ], }, 'targets': [ @@ -336,6 +341,25 @@ 'vendor/pdf_viewer/pdf_viewer.gyp:pdf_viewer', ], }], # enable_pdf_viewer + ['enable_pepper_flash==1', { + 'include_dirs': [ + '<(libchromiumcontent_src_dir)/chrome/browser/renderer_host/pepper', + '<(libchromiumcontent_src_dir)/chrome/renderer/pepper', + ], + 'link_settings': { + 'conditions': [ + ['OS=="win"', { + 'libraries': [ + '<(libchromiumcontent_dir)/pepper_flash.lib', + ] + }, { + 'libraries': [ + '<(libchromiumcontent_dir)/libpepper_flash.a', + ] + }], + ], + }, + }], # enable_pepper_flash ['libchromiumcontent_component', { 'link_settings': { 'libraries': [ '<@(libchromiumcontent_v8_libraries)' ], diff --git a/features.gypi b/features.gypi index ab0c34e85458..23d7d9907c23 100644 --- a/features.gypi +++ b/features.gypi @@ -7,11 +7,13 @@ 'enable_pdf_viewer%': 0, # FIXME(deepak1556) 'enable_run_as_node%': 1, 'enable_view_api%': 0, + 'enable_pepper_flash%': 1, }, 'enable_desktop_capturer%': '<(enable_desktop_capturer)', 'enable_osr%': '<(enable_osr)', 'enable_pdf_viewer%': '<(enable_pdf_viewer)', 'enable_run_as_node%': '<(enable_run_as_node)', 'enable_view_api%': '<(enable_view_api)', + 'enable_pepper_flash%': '<(enable_pepper_flash)', }, } diff --git a/filenames.gypi b/filenames.gypi index 19fb7492250f..7f02840d0c25 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -595,20 +595,6 @@ 'chromium_src/chrome/browser/process_singleton_posix.cc', 'chromium_src/chrome/browser/process_singleton_win.cc', 'chromium_src/chrome/browser/process_singleton.h', - 'chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc', - 'chromium_src/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h', - 'chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.h', - 'chromium_src/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc', - 'chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h', 'chromium_src/chrome/browser/speech/tts_controller.h', 'chromium_src/chrome/browser/speech/tts_controller_impl.cc', 'chromium_src/chrome/browser/speech/tts_controller_impl.h', @@ -646,20 +632,6 @@ 'chromium_src/chrome/common/widevine_cdm_constants.h', 'chromium_src/chrome/renderer/media/chrome_key_systems.cc', 'chromium_src/chrome/renderer/media/chrome_key_systems.h', - 'chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc', - 'chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h', - 'chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc', - 'chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.h', - 'chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc', - 'chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.h', - 'chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.cc', - 'chromium_src/chrome/renderer/pepper/pepper_flash_menu_host.h', - 'chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc', - 'chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.h', - 'chromium_src/chrome/renderer/pepper/pepper_helper.cc', - 'chromium_src/chrome/renderer/pepper/pepper_helper.h', - 'chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc', - 'chromium_src/chrome/renderer/pepper/pepper_shared_memory_message_filter.h', 'chromium_src/chrome/renderer/printing/print_web_view_helper.cc', 'chromium_src/chrome/renderer/printing/print_web_view_helper_linux.cc', 'chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm',