diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-23 16:47:21 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-23 16:47:21 +0000 |
commit | f3ecd3c606126f8a088ceb41e546bbbfb06e9e86 (patch) | |
tree | 4edf910e1e4b05f76ac10dc0c832a6b3e67ada93 | |
parent | 48ce68e1d07765eb8e3fcb6445f6fd95d273b1c9 (diff) | |
download | chromium_src-f3ecd3c606126f8a088ceb41e546bbbfb06e9e86.zip chromium_src-f3ecd3c606126f8a088ceb41e546bbbfb06e9e86.tar.gz chromium_src-f3ecd3c606126f8a088ceb41e546bbbfb06e9e86.tar.bz2 |
Hide knowledge of webkit::ppapi::PpapiInterfaceFactoryManager from chrome. This is part of moving ppapi implementation from webkit/plugins/ppapi to content/renderer.
Once webkit/plugins/ppapi moves to content, I will remove PpapiInterfaceFactoryManager altogether since plugin_module.cc will be able to call out to ContentRendererClient directly.
BUG=263054
R=piman@chromium.org
Review URL: https://codereview.chromium.org/19621006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213140 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/chrome_renderer.gypi | 2 | ||||
-rw-r--r-- | chrome/renderer/DEPS | 1 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 19 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.h | 4 | ||||
-rw-r--r-- | chrome/renderer/pepper/chrome_ppapi_interfaces.cc | 25 | ||||
-rw-r--r-- | chrome/renderer/pepper/chrome_ppapi_interfaces.h | 17 | ||||
-rw-r--r-- | content/public/renderer/content_renderer_client.cc | 5 | ||||
-rw-r--r-- | content/public/renderer/content_renderer_client.h | 11 | ||||
-rw-r--r-- | content/renderer/renderer_main.cc | 12 |
9 files changed, 32 insertions, 64 deletions
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index 3e7911b..8b6e0bd 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -234,8 +234,6 @@ 'renderer/external_extension.h', 'renderer/page_load_histograms.cc', 'renderer/page_load_histograms.h', - 'renderer/pepper/chrome_ppapi_interfaces.cc', - 'renderer/pepper/chrome_ppapi_interfaces.h', 'renderer/pepper/chrome_renderer_pepper_host_factory.cc', 'renderer/pepper/chrome_renderer_pepper_host_factory.h', 'renderer/pepper/pepper_extensions_common_host.cc', diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS index c00b5fb..a432cfe 100644 --- a/chrome/renderer/DEPS +++ b/chrome/renderer/DEPS @@ -21,7 +21,6 @@ include_rules = [ # TODO(jam): eliminate all of these. http://crbug.com/263054 "!webkit/plugins/ppapi/ppb_file_ref_impl.h", - "!webkit/plugins/ppapi/ppapi_interface_factory.h", "!webkit/plugins/ppapi/ppb_image_data_impl.h", "!webkit/plugins/ppapi/host_globals.h", "!webkit/plugins/ppapi/plugin_module.h", diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index ab39f59..945f982 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -48,8 +48,9 @@ #include "chrome/renderer/net_benchmarking_extension.h" #include "chrome/renderer/one_click_signin_agent.h" #include "chrome/renderer/page_load_histograms.h" -#include "chrome/renderer/pepper/chrome_ppapi_interfaces.h" #include "chrome/renderer/pepper/pepper_helper.h" +#include "chrome/renderer/pepper/ppb_nacl_private_impl.h" +#include "chrome/renderer/pepper/ppb_pdf_impl.h" #include "chrome/renderer/playback_extension.h" #include "chrome/renderer/plugins/plugin_placeholder.h" #include "chrome/renderer/plugins/plugin_uma.h" @@ -80,6 +81,8 @@ #include "grit/renderer_resources.h" #include "ipc/ipc_sync_channel.h" #include "net/base/net_errors.h" +#include "ppapi/c/private/ppb_nacl_private.h" +#include "ppapi/c/private/ppb_pdf.h" #include "ppapi/shared_impl/ppapi_switches.h" #include "third_party/WebKit/public/web/WebCache.h" #include "third_party/WebKit/public/web/WebDataSource.h" @@ -98,8 +101,6 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/webui/jstemplate_builder.h" #include "webkit/plugins/ppapi/plugin_module.h" -#include "webkit/plugins/ppapi/ppapi_interface_factory.h" - #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. #if defined(ENABLE_WEBRTC) @@ -1204,11 +1205,17 @@ bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { IsOtherExtensionWithWebRequestInstalled(); } -void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( - webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { +const void* ChromeContentRendererClient::CreatePPAPIInterface( + const std::string& interface_name) { #if defined(ENABLE_PLUGINS) - factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); +#if !defined(DISABLE_NACL) + if (interface_name == PPB_NACL_PRIVATE_INTERFACE) + return PPB_NaCl_Private_Impl::GetInterface(); +#endif // DISABLE_NACL + if (interface_name == PPB_PDF_INTERFACE) + return PPB_PDF_Impl::GetInterface(); #endif + return NULL; } bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle( diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index 8af6d11..44f2774 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -126,8 +126,8 @@ class ChromeContentRendererClient : public content::ContentRendererClient { const std::string& value) OVERRIDE; virtual bool AllowBrowserPlugin( WebKit::WebPluginContainer* container) const OVERRIDE; - virtual void RegisterPPAPIInterfaceFactories( - webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) OVERRIDE; + virtual const void* CreatePPAPIInterface( + const std::string& interface_name) OVERRIDE; // TODO(victorhsieh): move to ChromeContentBrowserClient once we migrate // PPAPI FileIO host to browser. virtual bool IsPluginAllowedToCallRequestOSFileHandle( diff --git a/chrome/renderer/pepper/chrome_ppapi_interfaces.cc b/chrome/renderer/pepper/chrome_ppapi_interfaces.cc deleted file mode 100644 index 91f5d3b..0000000 --- a/chrome/renderer/pepper/chrome_ppapi_interfaces.cc +++ /dev/null @@ -1,25 +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_ppapi_interfaces.h" - -#include "chrome/renderer/pepper/ppb_nacl_private_impl.h" -#include "chrome/renderer/pepper/ppb_pdf_impl.h" -#include "ppapi/c/private/ppb_nacl_private.h" -#include "ppapi/c/private/ppb_pdf.h" -#include "webkit/plugins/ppapi/ppapi_interface_factory.h" - -namespace chrome { - -const void* ChromePPAPIInterfaceFactory(const std::string& interface_name) { -#if !defined(DISABLE_NACL) - if (interface_name == PPB_NACL_PRIVATE_INTERFACE) - return PPB_NaCl_Private_Impl::GetInterface(); -#endif // DISABLE_NACL - if (interface_name == PPB_PDF_INTERFACE) - return PPB_PDF_Impl::GetInterface(); - return NULL; -} - -} // namespace chrome diff --git a/chrome/renderer/pepper/chrome_ppapi_interfaces.h b/chrome/renderer/pepper/chrome_ppapi_interfaces.h deleted file mode 100644 index cda78a7..0000000 --- a/chrome/renderer/pepper/chrome_ppapi_interfaces.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2011 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_PPAPI_INTERFACES_H_ -#define CHROME_RENDERER_PEPPER_CHROME_PPAPI_INTERFACES_H_ - -#include <string> - -namespace chrome { - -const void* ChromePPAPIInterfaceFactory(const std::string& interface_name); - -} // chrome - -#endif // CHROME_RENDERER_PEPPER_CHROME_PPAPI_INTERFACES_H_ - diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc index bc9565c..1d37ed4 100644 --- a/content/public/renderer/content_renderer_client.cc +++ b/content/public/renderer/content_renderer_client.cc @@ -158,6 +158,11 @@ bool ContentRendererClient::HandleSetCookieRequest( return false; } +const void* ContentRendererClient::CreatePPAPIInterface( + const std::string& interface_name) { + return NULL; +} + bool ContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle( WebKit::WebPluginContainer* container) const { return false; diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index dd75eb17..080d5ca 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -47,12 +47,6 @@ struct WebPluginParams; struct WebURLError; } -namespace webkit { -namespace ppapi { -class PpapiInterfaceFactoryManager; -} -} - namespace content { class RenderView; @@ -232,8 +226,9 @@ class CONTENT_EXPORT ContentRendererClient { const GURL& first_party_for_cookies, const std::string& value); - virtual void RegisterPPAPIInterfaceFactories( - webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) {} + // Allows an embedder to return custom PPAPI interfaces. + virtual const void* CreatePPAPIInterface( + const std::string& interface_name); // Returns true if plugin living in the container can use // pp::FileIO::RequestOSFileHandle. diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc index 0fd87e3..8857756 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc @@ -52,7 +52,7 @@ #endif namespace content { - +namespace { // This function provides some ways to test crash and assertion handling // behavior of the renderer. static void HandleRendererErrorTestParameters(const CommandLine& command_line) { @@ -109,6 +109,13 @@ class MemoryObserver : public base::MessageLoop::TaskObserver { DISALLOW_COPY_AND_ASSIGN(MemoryObserver); }; + +const void* ContentPPAPIInterfaceFactory(const std::string& interface_name) { + return GetContentClient()->renderer()->CreatePPAPIInterface(interface_name); +} + +} // namespace + // mainline routine for running as the Renderer process int RendererMain(const MainFunctionParams& parameters) { TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); @@ -144,8 +151,7 @@ int RendererMain(const MainFunctionParams& parameters) { webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager = webkit::ppapi::PpapiInterfaceFactoryManager::GetInstance(); - GetContentClient()->renderer()->RegisterPPAPIInterfaceFactories( - factory_manager); + factory_manager->RegisterFactory(ContentPPAPIInterfaceFactory); base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer); |