summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 22:24:43 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 22:24:43 +0000
commit490f79c179cc9df090dc68e36949ecc3458793da (patch)
tree1792cef02967fb6f8abe77e05d1f8ad015603ffb
parent3ffd3aec671a91b110860fc7c956f4d11a5be680 (diff)
downloadchromium_src-490f79c179cc9df090dc68e36949ecc3458793da.zip
chromium_src-490f79c179cc9df090dc68e36949ecc3458793da.tar.gz
chromium_src-490f79c179cc9df090dc68e36949ecc3458793da.tar.bz2
Add separate ContentClient interfaces for gpu/plugin/renderer processes. Since we don't have a need for a chrome/gpu or chrome/plugin directory, their chrome implementations are in chrome/common. Use the renderer one for getting the sad plugin image.
Review URL: http://codereview.chromium.org/6708013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78617 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chrome_main.cc14
-rw-r--r--chrome/browser/browser_main.cc2
-rw-r--r--chrome/browser/chrome_content_browser_client.cc2
-rw-r--r--chrome/browser/chrome_content_browser_client.h6
-rw-r--r--chrome/chrome_common.gypi4
-rw-r--r--chrome/chrome_dll.gypi2
-rw-r--r--chrome/chrome_renderer.gypi2
-rw-r--r--chrome/common/chrome_content_client.cc31
-rw-r--r--chrome/common/chrome_content_client.h2
-rw-r--r--chrome/common/chrome_content_gpu_client.cc15
-rw-r--r--chrome/common/chrome_content_gpu_client.h20
-rw-r--r--chrome/common/chrome_content_plugin_client.cc38
-rw-r--r--chrome/common/chrome_content_plugin_client.h20
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc16
-rw-r--r--chrome/renderer/chrome_content_renderer_client.h20
-rw-r--r--chrome/renderer/renderer_main.cc4
-rw-r--r--chrome/test/browser_with_test_window_test.cc2
-rw-r--r--chrome_frame/test/net/fake_external_tab.cc2
-rw-r--r--content/browser/content_browser_client.h8
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc2
-rw-r--r--content/browser/tab_contents/render_view_host_manager.cc3
-rw-r--r--content/common/content_client.cc2
-rw-r--r--content/common/content_client.h40
-rw-r--r--content/content_gpu.gypi1
-rw-r--r--content/content_plugin.gypi1
-rw-r--r--content/content_renderer.gypi1
-rw-r--r--content/gpu/content_gpu_client.h24
-rw-r--r--content/gpu/gpu_thread.cc4
-rw-r--r--content/plugin/content_plugin_client.h23
-rw-r--r--content/plugin/plugin_thread.cc4
-rw-r--r--content/renderer/content_renderer_client.h23
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc12
32 files changed, 270 insertions, 80 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index 400c637..ee6cc6b 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -26,6 +26,8 @@
#include "chrome/browser/platform_util.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_content_client.h"
+#include "chrome/common/chrome_content_gpu_client.h"
+#include "chrome/common/chrome_content_plugin_client.h"
#include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
@@ -211,7 +213,7 @@ void EnableHeapProfiler(const CommandLine& command_line) {
#endif
}
-void CommonSubprocessInit() {
+void CommonSubprocessInit(const std::string& process_type) {
#if defined(OS_WIN)
// HACK: Let Windows know that we have started. This is needed to suppress
// the IDC_APPSTARTING cursor from being displayed for a prolonged period
@@ -231,6 +233,14 @@ void CommonSubprocessInit() {
// surface UI -- but it's likely they get this wrong too so why not.
setlocale(LC_NUMERIC, "C");
#endif
+
+ if (process_type == switches::kPluginProcess) {
+ static chrome::ChromeContentPluginClient chrome_content_plugin_client;
+ content::GetContentClient()->set_plugin(&chrome_content_plugin_client);
+ } else if (process_type == switches::kGpuProcess) {
+ static chrome::ChromeContentGpuClient chrome_content_gpu_client;
+ content::GetContentClient()->set_gpu(&chrome_content_gpu_client);
+ }
}
// Returns true if this subprocess type needs the ResourceBundle initialized
@@ -722,7 +732,7 @@ int ChromeMain(int argc, char** argv) {
}
if (!process_type.empty())
- CommonSubprocessInit();
+ CommonSubprocessInit(process_type);
// Initialize the sandbox for this process.
SandboxInitWrapper sandbox_wrapper;
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 521d29b..3c160b4 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -1478,7 +1478,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
// Override the default ContentBrowserClient to let Chrome participate in
// content logic. Must be done before any tabs are created.
chrome::ChromeContentBrowserClient browser_client;
- content::GetContentClient()->set_browser_client(&browser_client);
+ content::GetContentClient()->set_browser(&browser_client);
// Tests should be able to tune login manager before showing it.
// Thus only show login manager in normal (non-testing) mode.
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index da6f45a..ce37842 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -11,7 +11,7 @@
namespace chrome {
-void ChromeContentBrowserClient::OnRenderViewCreation(
+void ChromeContentBrowserClient::PreCreateRenderView(
RenderViewHost* render_view_host,
Profile* profile,
const GURL& url) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 580c9e0..0cdbe51 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -12,9 +12,9 @@ namespace chrome {
class ChromeContentBrowserClient : public content::ContentBrowserClient {
public:
- virtual void OnRenderViewCreation(RenderViewHost* render_view_host,
- Profile* profile,
- const GURL& url);
+ virtual void PreCreateRenderView(RenderViewHost* render_view_host,
+ Profile* profile,
+ const GURL& url);
};
} // namespace chrome
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 2f58ec6..11c572f 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -144,6 +144,10 @@
'common/badge_util.h',
'common/chrome_content_client.cc',
'common/chrome_content_client.h',
+ 'common/chrome_content_gpu_client.cc',
+ 'common/chrome_content_gpu_client.h',
+ 'common/chrome_content_plugin_client.cc',
+ 'common/chrome_content_plugin_client.h',
'common/chrome_descriptors.h',
'common/common_glue.cc',
'common/css_colors.h',
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index 43b729e..5bdd04a 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -596,6 +596,8 @@
# and get rid of the common_constants.gypi which was added as a hack
# to avoid making common compile on 64 bit on Windows.
'../chrome/common/chrome_content_client.cc',
+ '../chrome/common/chrome_content_gpu_client.cc',
+ '../chrome/common/chrome_content_plugin_client.cc',
'../content/common/child_process.cc',
'../content/common/child_thread.cc',
'../content/common/content_client.cc',
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi
index ed5e13b..25fde16 100644
--- a/chrome/chrome_renderer.gypi
+++ b/chrome/chrome_renderer.gypi
@@ -84,6 +84,8 @@
'renderer/about_handler.h',
'renderer/blocked_plugin.cc',
'renderer/blocked_plugin.h',
+ 'renderer/chrome_content_renderer_client.cc',
+ 'renderer/chrome_content_renderer_client.h',
'renderer/devtools_agent.cc',
'renderer/devtools_agent.h',
'renderer/devtools_agent_filter.cc',
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 381c127..96795f6 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -5,15 +5,6 @@
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/child_process_logging.h"
-#include "chrome/common/default_plugin.h"
-
-#if defined(OS_MACOSX)
-#include "base/mac/mac_util.h"
-#include "base/mac/scoped_cftyperef.h"
-#include "base/sys_string_conversions.h"
-#include "grit/chromium_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-#endif
namespace chrome {
@@ -21,26 +12,4 @@ void ChromeContentClient::SetActiveURL(const GURL& url) {
child_process_logging::SetActiveURL(url);
}
-void ChromeContentClient::SetGpuInfo(const GPUInfo& gpu_info) {
- child_process_logging::SetGpuInfo(gpu_info);
-}
-
-void ChromeContentClient::PluginProcessStarted(const string16& plugin_name) {
-#if defined(OS_MACOSX)
- base::mac::ScopedCFTypeRef<CFStringRef> cf_plugin_name(
- base::SysUTF16ToCFStringRef(plugin_name));
- base::mac::ScopedCFTypeRef<CFStringRef> app_name(
- base::SysUTF16ToCFStringRef(
- l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME)));
- base::mac::ScopedCFTypeRef<CFStringRef> process_name(
- CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"),
- cf_plugin_name.get(), app_name.get()));
- base::mac::SetProcessName(process_name);
-#endif
-
-#if !defined(NACL_WIN64) // We don't link this in the NaCl 64 bit binary.
- chrome::RegisterInternalDefaultPlugin();
-#endif
-}
-
} // namespace chrome
diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h
index 92ceac0..e0f5a2a 100644
--- a/chrome/common/chrome_content_client.h
+++ b/chrome/common/chrome_content_client.h
@@ -13,8 +13,6 @@ namespace chrome {
class ChromeContentClient : public content::ContentClient {
public:
virtual void SetActiveURL(const GURL& url);
- virtual void SetGpuInfo(const GPUInfo& gpu_info);
- virtual void PluginProcessStarted(const string16& plugin_name);
};
} // namespace chrome
diff --git a/chrome/common/chrome_content_gpu_client.cc b/chrome/common/chrome_content_gpu_client.cc
new file mode 100644
index 0000000..15263aa
--- /dev/null
+++ b/chrome/common/chrome_content_gpu_client.cc
@@ -0,0 +1,15 @@
+// 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.
+
+#include "chrome/common/chrome_content_gpu_client.h"
+
+#include "chrome/common/child_process_logging.h"
+
+namespace chrome {
+
+void ChromeContentGpuClient::SetGpuInfo(const GPUInfo& gpu_info) {
+ child_process_logging::SetGpuInfo(gpu_info);
+}
+
+} // namespace chrome
diff --git a/chrome/common/chrome_content_gpu_client.h b/chrome/common/chrome_content_gpu_client.h
new file mode 100644
index 0000000..ad97188
--- /dev/null
+++ b/chrome/common/chrome_content_gpu_client.h
@@ -0,0 +1,20 @@
+// 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_COMMON_CHROME_CONTENT_GPU_CLIENT_H_
+#define CHROME_COMMON_CHROME_CONTENT_GPU_CLIENT_H_
+#pragma once
+
+#include "content/gpu/content_gpu_client.h"
+
+namespace chrome {
+
+class ChromeContentGpuClient : public content::ContentGpuClient {
+ public:
+ virtual void SetGpuInfo(const GPUInfo& gpu_info);
+};
+
+} // namespace chrome
+
+#endif // CHROME_COMMON_CHROME_CONTENT_GPU_CLIENT_H_
diff --git a/chrome/common/chrome_content_plugin_client.cc b/chrome/common/chrome_content_plugin_client.cc
new file mode 100644
index 0000000..1d38ee4
--- /dev/null
+++ b/chrome/common/chrome_content_plugin_client.cc
@@ -0,0 +1,38 @@
+// 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.
+
+#include "chrome/common/chrome_content_plugin_client.h"
+
+#include "chrome/common/default_plugin.h"
+
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
+#include "base/sys_string_conversions.h"
+#include "grit/chromium_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+#endif
+
+namespace chrome {
+
+void ChromeContentPluginClient::PluginProcessStarted(
+ const string16& plugin_name) {
+#if defined(OS_MACOSX)
+ base::mac::ScopedCFTypeRef<CFStringRef> cf_plugin_name(
+ base::SysUTF16ToCFStringRef(plugin_name));
+ base::mac::ScopedCFTypeRef<CFStringRef> app_name(
+ base::SysUTF16ToCFStringRef(
+ l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME)));
+ base::mac::ScopedCFTypeRef<CFStringRef> process_name(
+ CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"),
+ cf_plugin_name.get(), app_name.get()));
+ base::mac::SetProcessName(process_name);
+#endif
+
+#if !defined(NACL_WIN64) // We don't link this in the NaCl 64 bit binary.
+ chrome::RegisterInternalDefaultPlugin();
+#endif
+}
+
+} // namespace chrome
diff --git a/chrome/common/chrome_content_plugin_client.h b/chrome/common/chrome_content_plugin_client.h
new file mode 100644
index 0000000..6b6554b
--- /dev/null
+++ b/chrome/common/chrome_content_plugin_client.h
@@ -0,0 +1,20 @@
+// 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_COMMON_CHROME_CONTENT_PLUGIN_CLIENT_H_
+#define CHROME_COMMON_CHROME_CONTENT_PLUGIN_CLIENT_H_
+#pragma once
+
+#include "content/plugin/content_plugin_client.h"
+
+namespace chrome {
+
+class ChromeContentPluginClient : public content::ContentPluginClient {
+ public:
+ virtual void PluginProcessStarted(const string16& plugin_name);
+};
+
+} // namespace chrome
+
+#endif // CHROME_COMMON_CHROME_CONTENT_PLUGIN_CLIENT_H_
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
new file mode 100644
index 0000000..fe523d8
--- /dev/null
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -0,0 +1,16 @@
+// 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.
+
+#include "chrome/renderer/chrome_content_renderer_client.h"
+
+#include "grit/renderer_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace chrome {
+
+SkBitmap* ChromeContentRendererClient::GetSadPluginBitmap() {
+ return ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_SAD_PLUGIN);
+}
+
+} // namespace chrome
diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h
new file mode 100644
index 0000000..38c8d38
--- /dev/null
+++ b/chrome/renderer/chrome_content_renderer_client.h
@@ -0,0 +1,20 @@
+// 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_CHROME_CONTENT_RENDERER_CLIENT_H_
+#define CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_
+#pragma once
+
+#include "content/renderer/content_renderer_client.h"
+
+namespace chrome {
+
+class ChromeContentRendererClient : public content::ContentRendererClient {
+ public:
+ virtual SkBitmap* GetSadPluginBitmap();
+};
+
+} // namespace chrome
+
+#endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index d465e54..b04f7d3 100644
--- a/chrome/renderer/renderer_main.cc
+++ b/chrome/renderer/renderer_main.cc
@@ -26,6 +26,7 @@
#include "chrome/common/logging_chrome.h"
#include "chrome/common/net/net_resource_provider.h"
#include "chrome/common/pepper_plugin_registry.h"
+#include "chrome/renderer/chrome_content_renderer_client.h"
#include "chrome/renderer/renderer_main_platform_delegate.h"
#include "chrome/renderer/render_process_impl.h"
#include "chrome/renderer/render_thread.h"
@@ -180,6 +181,9 @@ static void HandleRendererErrorTestParameters(const CommandLine& command_line) {
int RendererMain(const MainFunctionParams& parameters) {
TRACE_EVENT_BEGIN("RendererMain", 0, "");
+ chrome::ChromeContentRendererClient renderer_client;
+ content::GetContentClient()->set_renderer(&renderer_client);
+
const CommandLine& parsed_command_line = parameters.command_line_;
base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_;
diff --git a/chrome/test/browser_with_test_window_test.cc b/chrome/test/browser_with_test_window_test.cc
index b115361..db0654a 100644
--- a/chrome/test/browser_with_test_window_test.cc
+++ b/chrome/test/browser_with_test_window_test.cc
@@ -35,7 +35,7 @@ void BrowserWithTestWindowTest::SetUp() {
// NOTE: I have a feeling we're going to want virtual methods for creating
// these, as such they're in SetUp instead of the constructor.
profile_.reset(new TestingProfile());
- content::GetContentClient()->set_browser_client(&browser_client_);
+ content::GetContentClient()->set_browser(&browser_client_);
browser_.reset(new Browser(Browser::TYPE_NORMAL, profile()));
window_.reset(new TestBrowserWindow(browser()));
browser_->set_window(window_.get());
diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc
index a37c1f4..b615463 100644
--- a/chrome_frame/test/net/fake_external_tab.cc
+++ b/chrome_frame/test/net/fake_external_tab.cc
@@ -495,7 +495,7 @@ int main(int argc, char** argv) {
content::SetContentClient(&chrome_content_client);
// Override the default ContentBrowserClient to let Chrome participate in
// content logic. Must be done before any tabs are created.
- content::GetContentClient()->set_browser_client(
+ content::GetContentClient()->set_browser(
new chrome::ChromeContentBrowserClient);
// TODO(tommi): Stuff be broke. Needs a fixin'.
diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h
index 7d5e916..b916263 100644
--- a/content/browser/content_browser_client.h
+++ b/content/browser/content_browser_client.h
@@ -6,6 +6,8 @@
#define CONTENT_BROWSER_CONTENT_BROWSER_CLIENT_H_
#pragma once
+#include "content/common/content_client.h"
+
class GURL;
class Profile;
class RenderViewHost;
@@ -16,9 +18,9 @@ namespace content {
class ContentBrowserClient {
public:
// Initialize a RenderViewHost before its CreateRenderView method is called.
- virtual void OnRenderViewCreation(RenderViewHost* render_view_host,
- Profile* profile,
- const GURL& url) {}
+ virtual void PreCreateRenderView(RenderViewHost* render_view_host,
+ Profile* profile,
+ const GURL& url) {}
};
} // namespace content
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index 5707937..d9e43f7 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -341,7 +341,7 @@ void RenderViewHostTestHarness::Reload() {
void RenderViewHostTestHarness::SetUp() {
// Initialize Chrome's ContentBrowserClient here, since we won't go through
// BrowserMain.
- content::GetContentClient()->set_browser_client(&browser_client_);
+ content::GetContentClient()->set_browser(&browser_client_);
contents_.reset(CreateTestTabContents());
}
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
index 51f5894..501a119 100644
--- a/content/browser/tab_contents/render_view_host_manager.cc
+++ b/content/browser/tab_contents/render_view_host_manager.cc
@@ -22,7 +22,6 @@
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/webui/web_ui.h"
#include "content/browser/webui/web_ui_factory.h"
-#include "content/common/content_client.h"
#include "content/common/notification_service.h"
#include "content/common/notification_type.h"
@@ -488,7 +487,7 @@ bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host,
// Give the embedder a chance to initialize the render view.
Profile* profile = delegate_->GetControllerForRenderManager().profile();
- content::GetContentClient()->browser_client()->OnRenderViewCreation(
+ content::GetContentClient()->browser()->PreCreateRenderView(
render_view_host, profile, entry.url());
return delegate_->CreateRenderViewForRenderManager(render_view_host);
diff --git a/content/common/content_client.cc b/content/common/content_client.cc
index 421e781..79fe8cc 100644
--- a/content/common/content_client.cc
+++ b/content/common/content_client.cc
@@ -17,7 +17,7 @@ ContentClient* GetContentClient() {
}
ContentClient::ContentClient() :
- browser_client_(NULL) {
+ browser_(NULL), gpu_(NULL), plugin_(NULL), renderer_(NULL) {
}
ContentClient::~ContentClient() {
diff --git a/content/common/content_client.h b/content/common/content_client.h
index 6ac6d54..8836a44 100644
--- a/content/common/content_client.h
+++ b/content/common/content_client.h
@@ -7,16 +7,17 @@
#pragma once
#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-class ContentBrowserClient;
class GURL;
-struct GPUInfo;
namespace content {
+class ContentBrowserClient;
class ContentClient;
+class ContentGpuClient;
+class ContentPluginClient;
+class ContentRendererClient;
+
// Setter and getter for the client. The client should be set early, before any
// content code is called.
void SetContentClient(ContentClient* client);
@@ -28,27 +29,28 @@ class ContentClient {
ContentClient();
~ContentClient();
- // Gets or sets the embedder API for participating in browser logic.
- // The client must be set early, before any content code is called.
- ContentBrowserClient* browser_client() {
- return browser_client_;
- }
- void set_browser_client(ContentBrowserClient* client) {
- browser_client_ = client;
- }
+ ContentBrowserClient* browser() { return browser_; }
+ void set_browser(ContentBrowserClient* c) { browser_ = c; }
+ ContentGpuClient* gpu() { return gpu_; }
+ void set_gpu(ContentGpuClient* g) { gpu_ = g; }
+ ContentPluginClient* plugin() { return plugin_; }
+ void set_plugin(ContentPluginClient* r) { plugin_ = r; }
+ ContentRendererClient* renderer() { return renderer_; }
+ void set_renderer(ContentRendererClient* r) { renderer_ = r; }
// Sets the URL that is logged if the child process crashes. Use GURL() to
// clear the URL.
virtual void SetActiveURL(const GURL& url) {}
- // Sets the data on the gpu to send along with crash reports.
- virtual void SetGpuInfo(const GPUInfo& gpu_info) {}
-
- // Notifies that a plugin process has started.
- virtual void PluginProcessStarted(const string16& plugin_name) {}
-
private:
- ContentBrowserClient* browser_client_;
+ // The embedder API for participating in browser logic.
+ ContentBrowserClient* browser_;
+ // The embedder API for participating in gpu logic.
+ ContentGpuClient* gpu_;
+ // The embedder API for participating in plugin logic.
+ ContentPluginClient* plugin_;
+ // The embedder API for participating in renderer logic.
+ ContentRendererClient* renderer_;
};
} // namespace content
diff --git a/content/content_gpu.gypi b/content/content_gpu.gypi
index ae65369..682eb51 100644
--- a/content/content_gpu.gypi
+++ b/content/content_gpu.gypi
@@ -19,6 +19,7 @@
'../skia/skia.gyp:skia',
],
'sources': [
+ 'gpu/content_gpu_client.h',
'gpu/gpu_channel.cc',
'gpu/gpu_channel.h',
'gpu/gpu_command_buffer_stub.cc',
diff --git a/content/content_plugin.gypi b/content/content_plugin.gypi
index 8886a04..94b4dc80 100644
--- a/content/content_plugin.gypi
+++ b/content/content_plugin.gypi
@@ -20,6 +20,7 @@
'sources': [
# All .cc, .h, .m, and .mm files under plugins except for tests and
# mocks.
+ 'plugin/content_plugin_client.h',
'plugin/npobject_base.h',
'plugin/npobject_proxy.cc',
'plugin/npobject_proxy.h',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 239c922..7c3ad94 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -25,6 +25,7 @@
'renderer/audio_device.h',
'renderer/audio_message_filter.cc',
'renderer/audio_message_filter.h',
+ 'renderer/content_renderer_client.h',
'renderer/cookie_message_filter.cc',
'renderer/cookie_message_filter.h',
'renderer/device_orientation_dispatcher.cc',
diff --git a/content/gpu/content_gpu_client.h b/content/gpu/content_gpu_client.h
new file mode 100644
index 0000000..e87f90b
--- /dev/null
+++ b/content/gpu/content_gpu_client.h
@@ -0,0 +1,24 @@
+// 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 CONTENT_GPU_CONTENT_GPU_CLIENT_H_
+#define CONTENT_GPU_CONTENT_GPU_CLIENT_H_
+#pragma once
+
+#include "content/common/content_client.h"
+
+struct GPUInfo;
+
+namespace content {
+
+// Embedder API for participating in plugin logic.
+class ContentGpuClient {
+ public:
+ // Sets the data on the gpu to send along with crash reports.
+ virtual void SetGpuInfo(const GPUInfo& gpu_info) {}
+};
+
+} // namespace content
+
+#endif // CONTENT_GPU_CONTENT_GPU_CLIENT_H_
diff --git a/content/gpu/gpu_thread.cc b/content/gpu/gpu_thread.cc
index 3dc960e..d620747 100644
--- a/content/gpu/gpu_thread.cc
+++ b/content/gpu/gpu_thread.cc
@@ -14,9 +14,9 @@
#include "base/threading/worker_pool.h"
#include "build/build_config.h"
#include "content/common/child_process.h"
-#include "content/common/content_client.h"
#include "content/common/content_switches.h"
#include "content/common/gpu_messages.h"
+#include "content/gpu/content_gpu_client.h"
#include "content/gpu/gpu_info_collector.h"
#include "content/gpu/gpu_watchdog_thread.h"
#include "ipc/ipc_channel_handle.h"
@@ -132,7 +132,7 @@ void GpuThread::OnInitialize() {
}
gpu_info_collector::CollectGraphicsInfo(&gpu_info_);
- content::GetContentClient()->SetGpuInfo(gpu_info_);
+ content::GetContentClient()->gpu()->SetGpuInfo(gpu_info_);
LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete";
// Record initialization only after collecting the GPU info because that can
diff --git a/content/plugin/content_plugin_client.h b/content/plugin/content_plugin_client.h
new file mode 100644
index 0000000..a8f3974
--- /dev/null
+++ b/content/plugin/content_plugin_client.h
@@ -0,0 +1,23 @@
+// 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 CONTENT_PLUGIN_CONTENT_PLUGIN_CLIENT_H_
+#define CONTENT_PLUGIN_CONTENT_PLUGIN_CLIENT_H_
+#pragma once
+
+#include "base/string16.h"
+#include "content/common/content_client.h"
+
+namespace content {
+
+// Embedder API for participating in plugin logic.
+class ContentPluginClient {
+ public:
+ // Notifies that a plugin process has started.
+ virtual void PluginProcessStarted(const string16& plugin_name) {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PLUGIN_CONTENT_PLUGIN_CLIENT_H_
diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc
index c2ca935..1d14c22 100644
--- a/content/plugin/plugin_thread.cc
+++ b/content/plugin/plugin_thread.cc
@@ -20,10 +20,10 @@
#include "base/process_util.h"
#include "base/threading/thread_local.h"
#include "content/common/child_process.h"
-#include "content/common/content_client.h"
#include "content/common/content_switches.h"
#include "content/common/child_process_messages.h"
#include "content/common/plugin_messages.h"
+#include "content/plugin/content_plugin_client.h"
#include "content/plugin/npobject_util.h"
#include "ipc/ipc_channel_handle.h"
#include "net/base/net_errors.h"
@@ -81,7 +81,7 @@ PluginThread::PluginThread()
if (plugin.get())
plugin->NP_Initialize();
- content::GetContentClient()->PluginProcessStarted(
+ content::GetContentClient()->plugin()->PluginProcessStarted(
plugin.get() ? plugin->plugin_info().name : string16());
// Certain plugins, such as flash, steal the unhandled exception filter
diff --git a/content/renderer/content_renderer_client.h b/content/renderer/content_renderer_client.h
new file mode 100644
index 0000000..4c94f31
--- /dev/null
+++ b/content/renderer/content_renderer_client.h
@@ -0,0 +1,23 @@
+// 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 CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_
+#define CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_
+#pragma once
+
+#include "content/common/content_client.h"
+
+class SkBitmap;
+
+namespace content {
+
+// Embedder API for participating in renderer logic.
+class ContentRendererClient {
+ public:
+ virtual SkBitmap* GetSadPluginBitmap() { return NULL; }
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index e8ac928..0c018cd 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -29,8 +29,8 @@
#include "content/plugin/npobject_stub.h"
#include "content/plugin/npobject_util.h"
#include "content/renderer/command_buffer_proxy.h"
+#include "content/renderer/content_renderer_client.h"
#include "content/renderer/plugin_channel_host.h"
-//#include "grit/renderer_resources.h"
#include "ipc/ipc_channel_handle.h"
#include "net/base/mime_util.h"
#include "skia/ext/platform_canvas.h"
@@ -40,7 +40,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
-#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/blit.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/native_widget_types.h"
@@ -1151,12 +1150,9 @@ void WebPluginDelegateProxy::OnMissingPluginStatus(int status) {
void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context,
const gfx::Rect& rect) {
// Lazily load the sad plugin image.
- /* temporarily disabled by jam
- if (!sad_plugin_) {
- sad_plugin_ = ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_SAD_PLUGIN);
- }
- */
+ if (!sad_plugin_)
+ sad_plugin_ = content::GetContentClient()->renderer()->GetSadPluginBitmap();
+
if (!sad_plugin_)
return;