diff options
43 files changed, 260 insertions, 588 deletions
diff --git a/ash/shell/content_client/shell_main_delegate.cc b/ash/shell/content_client/shell_main_delegate.cc index 3257ae2..343ba27 100644 --- a/ash/shell/content_client/shell_main_delegate.cc +++ b/ash/shell/content_client/shell_main_delegate.cc @@ -9,9 +9,6 @@ #include "base/file_path.h" #include "base/path_service.h" #include "content/public/common/content_switches.h" -#include "content/shell/shell_content_plugin_client.h" -#include "content/shell/shell_content_renderer_client.h" -#include "content/shell/shell_content_utility_client.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" @@ -30,7 +27,6 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { command_line.GetSwitchValueASCII(switches::kProcessType); content::SetContentClient(&content_client_); - InitializeShellContentClient(process_type); return false; } @@ -39,31 +35,9 @@ void ShellMainDelegate::PreSandboxStartup() { InitializeResourceBundle(); } -#if defined(OS_POSIX) - -void ShellMainDelegate::ZygoteForked() { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); - InitializeShellContentClient(process_type); -} -#endif - -void ShellMainDelegate::InitializeShellContentClient( - const std::string& process_type) { - if (process_type.empty()) { - browser_client_.reset(new ShellContentBrowserClient); - content::GetContentClient()->set_browser(browser_client_.get()); - } else if (process_type == switches::kRendererProcess) { - renderer_client_.reset(new content::ShellContentRendererClient); - content::GetContentClient()->set_renderer(renderer_client_.get()); - } else if (process_type == switches::kPluginProcess) { - plugin_client_.reset(new content::ShellContentPluginClient); - content::GetContentClient()->set_plugin(plugin_client_.get()); - } else if (process_type == switches::kUtilityProcess) { - utility_client_.reset(new content::ShellContentUtilityClient); - content::GetContentClient()->set_utility(utility_client_.get()); - } +content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { + browser_client_.reset(new ShellContentBrowserClient); + return browser_client_.get(); } void ShellMainDelegate::InitializeResourceBundle() { diff --git a/ash/shell/content_client/shell_main_delegate.h b/ash/shell/content_client/shell_main_delegate.h index 54cc24f..0d297b6 100644 --- a/ash/shell/content_client/shell_main_delegate.h +++ b/ash/shell/content_client/shell_main_delegate.h @@ -29,18 +29,12 @@ class ShellMainDelegate : public content::ContentMainDelegate { virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; virtual void PreSandboxStartup() OVERRIDE; -#if defined(OS_POSIX) - virtual void ZygoteForked() OVERRIDE; -#endif // OS_MACOSX + virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; private: - void InitializeShellContentClient(const std::string& process_type); void InitializeResourceBundle(); scoped_ptr<ShellContentBrowserClient> browser_client_; - scoped_ptr<content::ShellContentRendererClient> renderer_client_; - scoped_ptr<content::ShellContentPluginClient> plugin_client_; - scoped_ptr<content::ShellContentUtilityClient> utility_client_; content::ShellContentClient content_client_; DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index e00b553..ab0729b1 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -255,26 +255,6 @@ void EnableHeapProfiler(const CommandLine& command_line) { #endif } -void InitializeChromeContentRendererClient() { - content::GetContentClient()->set_renderer( - &g_chrome_content_renderer_client.Get()); -} - -void InitializeChromeContentClient(const std::string& process_type) { - if (process_type.empty()) { - content::GetContentClient()->set_browser( - &g_chrome_content_browser_client.Get()); - } else if (process_type == switches::kPluginProcess) { - content::GetContentClient()->set_plugin( - &g_chrome_content_plugin_client.Get()); - } else if (process_type == switches::kRendererProcess) { - InitializeChromeContentRendererClient(); - } else if (process_type == switches::kUtilityProcess) { - content::GetContentClient()->set_utility( - &g_chrome_content_utility_client.Get()); - } -} - // Returns true if this subprocess type needs the ResourceBundle initialized // and resources loaded. bool SubprocessNeedsResourceBundle(const std::string& process_type) { @@ -447,10 +427,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { base::FieldTrial::EnableBenchmarking(); } - std::string process_type = command_line.GetSwitchValueASCII( - switches::kProcessType); content::SetContentClient(&chrome_content_client_); - InitializeChromeContentClient(process_type); return false; } @@ -584,9 +561,6 @@ void ChromeMainDelegate::PreSandboxStartup() { if (command_line.HasSwitch(switches::kMessageLoopHistogrammer)) MessageLoop::EnableHistogrammer(true); - if (command_line.HasSwitch(switches::kSingleProcess)) - InitializeChromeContentRendererClient(); - logging::OldFileDeletionState file_state = logging::APPEND_TO_OLD_LOG_FILE; if (process_type.empty()) { @@ -716,10 +690,6 @@ content::ZygoteForkDelegate* ChromeMainDelegate::ZygoteStarting() { } void ChromeMainDelegate::ZygoteForked() { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); - Profiling::ProcessStarted(); if (Profiling::BeingProfiled()) { base::debug::RestartProfilingAfterFork(); @@ -731,7 +701,25 @@ void ChromeMainDelegate::ZygoteForked() { // this up for the browser process in a different manner. InitCrashReporter(); #endif - - InitializeChromeContentClient(process_type); } + #endif // OS_MACOSX + +content::ContentBrowserClient* + ChromeMainDelegate::CreateContentBrowserClient() { + return &g_chrome_content_browser_client.Get(); +} + +content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() { + return &g_chrome_content_plugin_client.Get(); +} + +content::ContentRendererClient* + ChromeMainDelegate::CreateContentRendererClient() { + return &g_chrome_content_renderer_client.Get(); +} + +content::ContentUtilityClient* + ChromeMainDelegate::CreateContentUtilityClient() { + return &g_chrome_content_utility_client.Get(); +} diff --git a/chrome/app/chrome_main_delegate.h b/chrome/app/chrome_main_delegate.h index 3e9b72a..faa1920 100644 --- a/chrome/app/chrome_main_delegate.h +++ b/chrome/app/chrome_main_delegate.h @@ -17,20 +17,15 @@ class ChromeMainDelegate : public content::ContentMainDelegate { ChromeMainDelegate(); virtual ~ChromeMainDelegate(); + private: + // content::ContentMainDelegate implementation: virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; - -#if defined(OS_MACOSX) - void InitMacCrashReporter(const CommandLine& command_line, - const std::string& process_type); -#endif // defined(OS_MACOSX) - virtual void PreSandboxStartup() OVERRIDE; virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; virtual int RunProcess( const std::string& process_type, const content::MainFunctionParams& main_function_params) OVERRIDE; virtual void ProcessExiting(const std::string& process_type) OVERRIDE; - #if defined(OS_MACOSX) virtual bool ProcessRegistersWithSystemProcess( const std::string& process_type) OVERRIDE; @@ -41,8 +36,17 @@ class ChromeMainDelegate : public content::ContentMainDelegate { virtual content::ZygoteForkDelegate* ZygoteStarting() OVERRIDE; virtual void ZygoteForked() OVERRIDE; #endif + virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; + virtual content::ContentPluginClient* CreateContentPluginClient() OVERRIDE; + virtual content::ContentRendererClient* + CreateContentRendererClient() OVERRIDE; + virtual content::ContentUtilityClient* CreateContentUtilityClient() OVERRIDE; + +#if defined(OS_MACOSX) + void InitMacCrashReporter(const CommandLine& command_line, + const std::string& process_type); +#endif // defined(OS_MACOSX) - private: chrome::ChromeContentClient chrome_content_client_; scoped_ptr<base::StatsScope<base::StatsCounterTimer> > startup_timer_; diff --git a/chrome/test/base/chrome_render_view_test.cc b/chrome/test/base/chrome_render_view_test.cc index 15f91e7..80901c2 100644 --- a/chrome/test/base/chrome_render_view_test.cc +++ b/chrome/test/base/chrome_render_view_test.cc @@ -51,7 +51,8 @@ ChromeRenderViewTest::~ChromeRenderViewTest() { } void ChromeRenderViewTest::SetUp() { - content::GetContentClient()->set_renderer(&chrome_content_renderer_client_); + content::GetContentClient()->set_renderer_for_testing( + &chrome_content_renderer_client_); extension_dispatcher_ = new ExtensionDispatcher(); chrome_content_renderer_client_.SetExtensionDispatcher(extension_dispatcher_); diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc index cdda117..d66eec5 100644 --- a/chrome/test/base/chrome_test_suite.cc +++ b/chrome/test/base/chrome_test_suite.cc @@ -105,7 +105,7 @@ class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener { DCHECK(!content::GetContentClient()); content_client_.reset(new chrome::ChromeContentClient); browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); - content_client_->set_browser(browser_content_client_.get()); + content_client_->set_browser_for_testing(browser_content_client_.get()); content::SetContentClient(content_client_.get()); SetUpHostResolver(); diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index 3042514..b490213 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -28,6 +28,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/url_constants.h" +#include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/test/base/chrome_test_suite.h" #include "chrome/test/base/test_launcher_utils.h" #include "chrome/test/base/testing_browser_process.h" @@ -37,7 +38,6 @@ #include "content/public/browser/render_process_host.h" #include "content/public/test/test_browser_thread.h" #include "content/public/test/test_launcher.h" -#include "content/renderer/mock_content_renderer_client.h" #include "net/base/mock_host_resolver.h" #include "net/test/test_server.h" #include "ui/compositor/compositor_switches.h" @@ -114,8 +114,8 @@ void InProcessBrowserTest::SetUp() { if (command_line->HasSwitch(switches::kSingleProcess)) { content::RenderProcessHost::set_run_renderer_in_process(true); single_process_renderer_client_.reset( - new content::MockContentRendererClient); - content::GetContentClient()->set_renderer( + new chrome::ChromeContentRendererClient); + content::GetContentClient()->set_renderer_for_testing( single_process_renderer_client_.get()); } diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index d73d03d..203fa1f 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -147,17 +147,19 @@ class FakeMainDelegate : public content::ContentMainDelegate { logging_win::InstallTestLogCollector( testing::UnitTest::GetInstance()); - // Initialize the content client. content::SetContentClient(&g_chrome_content_client.Get()); - - // Override the default ContentBrowserClient to let Chrome participate in - // content logic. We use a subclass of Chrome's implementation, - // FakeContentBrowserClient, to override CreateBrowserMainParts. Must - // be done before any tabs are created. - content::GetContentClient()->set_browser(&g_browser_client.Get()); - content::GetContentClient()->set_renderer(&g_renderer_client.Get()); + content::GetContentClient()->set_renderer_for_testing( + &g_renderer_client.Get()); return false; } + + // Override the default ContentBrowserClient to let Chrome participate in + // content logic. We use a subclass of Chrome's implementation, + // FakeContentBrowserClient, to override CreateBrowserMainParts. Must + // be done before any tabs are created. + virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE { + return &g_browser_client.Get(); + }; }; void FilterDisabledTests() { diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 02eacd2..646becc 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -11,6 +11,7 @@ #include "base/debug/trace_event.h" #include "base/file_path.h" #include "base/i18n/icu_util.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/stats_table.h" @@ -23,12 +24,16 @@ #include "content/common/url_schemes.h" #include "content/public/app/content_main_delegate.h" #include "content/public/app/startup_helper_win.h" +#include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" #include "content/public/common/sandbox_init.h" +#include "content/public/plugin/content_plugin_client.h" +#include "content/public/renderer/content_renderer_client.h" +#include "content/public/utility/content_utility_client.h" #include "crypto/nss_util.h" #include "ipc/ipc_switches.h" #include "media/base/media.h" @@ -81,12 +86,21 @@ extern int WorkerMain(const content::MainFunctionParams&); extern int UtilityMain(const content::MainFunctionParams&); #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) namespace content { -extern int ZygoteMain(const content::MainFunctionParams&, - content::ZygoteForkDelegate* forkdelegate); +extern int ZygoteMain(const MainFunctionParams&, + ZygoteForkDelegate* forkdelegate); } // namespace content #endif -namespace { +namespace content { + +base::LazyInstance<ContentBrowserClient> + g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<ContentPluginClient> + g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<ContentRendererClient> + g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<ContentUtilityClient> + g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; #if defined(OS_WIN) @@ -206,20 +220,50 @@ static void InitializeStatsTable(const CommandLine& command_line) { // NOTIMPLEMENTED: we probably need to shut this down correctly to avoid // leaking shared memory regions on posix platforms. std::string statsfile = - base::StringPrintf( - "%s-%u", content::kStatsFilename, + base::StringPrintf("%s-%u", kStatsFilename, static_cast<unsigned int>(GetBrowserPid(command_line))); base::StatsTable* stats_table = new base::StatsTable(statsfile, - content::kStatsMaxThreads, content::kStatsMaxCounters); + kStatsMaxThreads, kStatsMaxCounters); base::StatsTable::set_current(stats_table); } } +class ContentClientInitializer { + public: + static void Set(const std::string& process_type, + ContentMainDelegate* delegate) { + ContentClient* content_client = GetContentClient(); + if (process_type.empty()) { + if (delegate) + content_client->browser_ = delegate->CreateContentBrowserClient(); + if (!content_client->browser_) + content_client->browser_ = &g_empty_content_browser_client.Get(); + } + + if (process_type == switches::kPluginProcess) { + if (delegate) + content_client->plugin_ = delegate->CreateContentPluginClient(); + if (!content_client->plugin_) + content_client->plugin_ = &g_empty_content_plugin_client.Get(); + } else if (process_type == switches::kRendererProcess) { + if (delegate) + content_client->renderer_ = delegate->CreateContentRendererClient(); + if (!content_client->renderer_) + content_client->renderer_ = &g_empty_content_renderer_client.Get(); + } else if (process_type == switches::kUtilityProcess) { + if (delegate) + content_client->utility_ = delegate->CreateContentUtilityClient(); + if (!content_client->utility_) + content_client->utility_ = &g_empty_content_utility_client.Get(); + } + } +}; + // We dispatch to a process-type-specific FooMain() based on a command-line // flag. This struct is used to build a table of (flag, main function) pairs. struct MainFunction { const char* name; - int (*function)(const content::MainFunctionParams&); + int (*function)(const MainFunctionParams&); }; #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) @@ -227,8 +271,8 @@ struct MainFunction { // subprocesses that are launched via the zygote. This function // fills in some process-launching bits around ZygoteMain(). // Returns the exit code of the subprocess. -int RunZygote(const content::MainFunctionParams& main_function_params, - content::ContentMainDelegate* delegate) { +int RunZygote(const MainFunctionParams& main_function_params, + ContentMainDelegate* delegate) { static const MainFunction kMainFunctions[] = { { switches::kRendererProcess, RendererMain }, { switches::kWorkerProcess, WorkerMain }, @@ -236,19 +280,19 @@ int RunZygote(const content::MainFunctionParams& main_function_params, { switches::kUtilityProcess, UtilityMain }, }; - scoped_ptr<content::ZygoteForkDelegate> zygote_fork_delegate; + scoped_ptr<ZygoteForkDelegate> zygote_fork_delegate; if (delegate) { zygote_fork_delegate.reset(delegate->ZygoteStarting()); // Each Renderer we spawn will re-attempt initialization of the media // libraries, at which point failure will be detected and handled, so // we do not need to cope with initialization failures here. FilePath media_path; - if (PathService::Get(content::DIR_MEDIA_LIBS, &media_path)) + if (PathService::Get(DIR_MEDIA_LIBS, &media_path)) media::InitializeMediaLibrary(media_path); } // This function call can return multiple times, once per fork(). - if (!content::ZygoteMain(main_function_params, zygote_fork_delegate.get())) + if (!ZygoteMain(main_function_params, zygote_fork_delegate.get())) return 1; if (delegate) delegate->ZygoteForked(); @@ -256,6 +300,9 @@ int RunZygote(const content::MainFunctionParams& main_function_params, // Zygote::HandleForkRequest may have reallocated the command // line so update it here with the new version. const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + std::string process_type = + command_line.GetSwitchValueASCII(switches::kProcessType); + ContentClientInitializer::Set(process_type, delegate); // If a custom user agent was passed on the command line, we need // to (re)set it now, rather than using the default one the zygote @@ -270,11 +317,7 @@ int RunZygote(const content::MainFunctionParams& main_function_params, // within the new processes as well. InitializeStatsTable(command_line); - content::MainFunctionParams main_params(command_line); - - // Get the new process type from the new command line. - std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); + MainFunctionParams main_params(command_line); for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { if (process_type == kMainFunctions[i].name) @@ -294,8 +337,8 @@ int RunZygote(const content::MainFunctionParams& main_function_params, // Returns the exit code for this process. int RunNamedProcessTypeMain( const std::string& process_type, - const content::MainFunctionParams& main_function_params, - content::ContentMainDelegate* delegate) { + const MainFunctionParams& main_function_params, + ContentMainDelegate* delegate) { static const MainFunction kMainFunctions[] = { { "", BrowserMain }, { switches::kRendererProcess, RendererMain }, @@ -334,7 +377,7 @@ int RunNamedProcessTypeMain( return 1; } -class ContentMainRunnerImpl : public content::ContentMainRunner { +class ContentMainRunnerImpl : public ContentMainRunner { public: ContentMainRunnerImpl() : is_initialized_(false), @@ -361,12 +404,12 @@ static void ReleaseFreeMemoryThunk() { #if defined(OS_WIN) virtual int Initialize(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sandbox_info, - content::ContentMainDelegate* delegate) OVERRIDE { + ContentMainDelegate* delegate) OVERRIDE { // argc/argv are ignored on Windows; see command_line.h for details. int argc = 0; char** argv = NULL; - content::RegisterInvalidParamHandler(); + RegisterInvalidParamHandler(); _Module.Init(NULL, static_cast<HINSTANCE>(instance)); if (sandbox_info) @@ -377,7 +420,7 @@ static void ReleaseFreeMemoryThunk() { #else // !OS_WIN virtual int Initialize(int argc, const char** argv, - content::ContentMainDelegate* delegate) OVERRIDE { + ContentMainDelegate* delegate) OVERRIDE { // NOTE(willchan): One might ask why this call is done here rather than in // process_util_linux.cc with the definition of @@ -448,14 +491,16 @@ static void ReleaseFreeMemoryThunk() { int exit_code; if (delegate && delegate->BasicStartupComplete(&exit_code)) return exit_code; - DCHECK(!delegate || content::GetContentClient()) << - "BasicStartupComplete didn't set the content client"; completed_basic_startup_ = true; const CommandLine& command_line = *CommandLine::ForCurrentProcess(); std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); + command_line.GetSwitchValueASCII(switches::kProcessType); + + if (!GetContentClient()) + SetContentClient(&empty_content_client_); + ContentClientInitializer::Set(process_type, delegate_); // Enable startup tracing asap to avoid early TRACE_EVENT calls being // ignored. @@ -487,7 +532,7 @@ static void ReleaseFreeMemoryThunk() { #if defined(ENABLE_HIDPI) ui::EnableHighDPISupport(); #endif - content::SetupCRT(command_line); + SetupCRT(command_line); #endif #if defined(OS_POSIX) @@ -513,8 +558,8 @@ static void ReleaseFreeMemoryThunk() { #endif ui::RegisterPathProvider(); - content::RegisterPathProvider(); - content::RegisterContentSchemes(true); + RegisterPathProvider(); + RegisterContentSchemes(true); CHECK(icu_util::Initialize()); @@ -535,7 +580,7 @@ static void ReleaseFreeMemoryThunk() { CommonSubprocessInit(process_type); #if defined(OS_WIN) - CHECK(content::InitializeSandbox(sandbox_info)); + CHECK(InitializeSandbox(sandbox_info)); #elif defined(OS_MACOSX) if (process_type == switches::kRendererProcess || process_type == switches::kPpapiPluginProcess || @@ -543,7 +588,7 @@ static void ReleaseFreeMemoryThunk() { // On OS X the renderer sandbox needs to be initialized later in the // startup sequence in RendererMainPlatformDelegate::EnableSandbox(). } else { - CHECK(content::InitializeSandbox()); + CHECK(InitializeSandbox()); } #endif @@ -565,7 +610,7 @@ static void ReleaseFreeMemoryThunk() { std::string process_type = command_line.GetSwitchValueASCII(switches::kProcessType); - content::MainFunctionParams main_params(command_line); + MainFunctionParams main_params(command_line); #if defined(OS_WIN) main_params.sandbox_info = &sandbox_info_; #elif defined(OS_MACOSX) @@ -605,7 +650,7 @@ static void ReleaseFreeMemoryThunk() { is_shutdown_ = true; } - protected: + private: // True if the runner has been initialized. bool is_initialized_; @@ -615,8 +660,11 @@ static void ReleaseFreeMemoryThunk() { // True if basic startup was completed. bool completed_basic_startup_; + // Used if the embedder doesn't set one. + ContentClient empty_content_client_; + // The delegate will outlive this object. - content::ContentMainDelegate* delegate_; + ContentMainDelegate* delegate_; scoped_ptr<base::AtExitManager> exit_manager_; #if defined(OS_WIN) @@ -628,10 +676,6 @@ static void ReleaseFreeMemoryThunk() { DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); }; -} // namespace - -namespace content { - // static ContentMainRunner* ContentMainRunner::Create() { return new ContentMainRunnerImpl(); diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index 39d50d3..77be482 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -9,9 +9,9 @@ #include "base/file_path.h" #include "base/platform_file.h" #include "content/browser/child_process_security_policy_impl.h" -#include "content/browser/mock_content_browser_client.h" #include "content/common/test_url_constants.h" #include "content/public/common/url_constants.h" +#include "content/test/test_content_browser_client.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" @@ -21,7 +21,7 @@ const int kRendererID = 42; const int kWorkerRendererID = kRendererID + 1; class ChildProcessSecurityPolicyTestBrowserClient - : public content::MockContentBrowserClient { + : public content::TestContentBrowserClient { public: ChildProcessSecurityPolicyTestBrowserClient() {} @@ -50,7 +50,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { virtual void SetUp() { old_browser_client_ = content::GetContentClient()->browser(); - content::GetContentClient()->set_browser(&test_browser_client_); + content::GetContentClient()->set_browser_for_testing(&test_browser_client_); // Claim to always handle chrome:// URLs because the CPSP's notion of // allowing WebUI bindings is hard-wired to this particular scheme. @@ -59,7 +59,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { virtual void TearDown() { test_browser_client_.ClearSchemes(); - content::GetContentClient()->set_browser(old_browser_client_); + content::GetContentClient()->set_browser_for_testing(old_browser_client_); } protected: diff --git a/content/browser/debugger/devtools_manager_unittest.cc b/content/browser/debugger/devtools_manager_unittest.cc index 51f705b..c6a1507 100644 --- a/content/browser/debugger/devtools_manager_unittest.cc +++ b/content/browser/debugger/devtools_manager_unittest.cc @@ -6,7 +6,6 @@ #include "base/time.h" #include "content/browser/debugger/devtools_manager_impl.h" #include "content/browser/debugger/render_view_devtools_agent_host.h" -#include "content/browser/mock_content_browser_client.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/web_contents/test_web_contents.h" #include "content/common/view_messages.h" @@ -14,6 +13,7 @@ #include "content/public/browser/devtools_agent_host_registry.h" #include "content/public/browser/devtools_client_host.h" #include "content/public/browser/web_contents_delegate.h" +#include "content/test/test_content_browser_client.h" #include "testing/gtest/include/gtest/gtest.h" using base::TimeDelta; @@ -92,7 +92,7 @@ class TestWebContentsDelegate : public content::WebContentsDelegate { }; class DevToolsManagerTestBrowserClient - : public content::MockContentBrowserClient { + : public content::TestContentBrowserClient { public: DevToolsManagerTestBrowserClient() { } @@ -118,7 +118,7 @@ class DevToolsManagerTest : public RenderViewHostImplTestHarness { protected: virtual void SetUp() OVERRIDE { original_browser_client_ = content::GetContentClient()->browser(); - content::GetContentClient()->set_browser(&browser_client_); + content::GetContentClient()->set_browser_for_testing(&browser_client_); RenderViewHostImplTestHarness::SetUp(); TestDevToolsClientHost::ResetCounters(); @@ -126,7 +126,8 @@ class DevToolsManagerTest : public RenderViewHostImplTestHarness { virtual void TearDown() OVERRIDE { RenderViewHostImplTestHarness::TearDown(); - content::GetContentClient()->set_browser(original_browser_client_); + content::GetContentClient()->set_browser_for_testing( + original_browser_client_); } private: diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index a2c6095..0539bb8 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc @@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/message_loop.h" #include "content/browser/browser_thread_impl.h" -#include "content/browser/mock_content_browser_client.h" #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" #include "content/browser/renderer_host/media/media_stream_manager.h" #include "content/browser/renderer_host/media/mock_media_observer.h" @@ -15,6 +14,7 @@ #include "content/common/media/media_stream_messages.h" #include "content/common/media/media_stream_options.h" #include "content/public/test/mock_resource_context.h" +#include "content/test/test_content_browser_client.h" #include "content/test/test_content_client.h" #include "ipc/ipc_message_macros.h" #include "media/audio/audio_manager.h" @@ -37,7 +37,7 @@ const int kPageRequestId = 7; namespace media_stream { class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, - public content::MockContentBrowserClient { + public content::TestContentBrowserClient { public: MockMediaStreamDispatcherHost(content::ResourceContext* resource_context, MessageLoop* message_loop, @@ -179,7 +179,7 @@ class MediaStreamDispatcherHostTest : public testing::Test { old_browser_client_ = content::GetContentClient()->browser(); content_client_.reset(new TestContentClient); content::SetContentClient(content_client_.get()); - content_client_->set_browser(host_); + content_client_->set_browser_for_testing(host_); } virtual void TearDown() { @@ -187,7 +187,7 @@ class MediaStreamDispatcherHostTest : public testing::Test { SyncWithVideoCaptureManagerThread(); // Recover the old browser client and content client. - content::GetContentClient()->set_browser(old_browser_client_); + content::GetContentClient()->set_browser_for_testing(old_browser_client_); content::SetContentClient(old_client_); content_client_.reset(); } diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index b40919b..37ab73a 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc @@ -8,7 +8,6 @@ #include "content/browser/browser_thread_impl.h" #include "content/browser/browsing_instance.h" #include "content/browser/child_process_security_policy_impl.h" -#include "content/browser/mock_content_browser_client.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/test_render_view_host.h" @@ -22,6 +21,7 @@ #include "content/public/test/mock_render_process_host.h" #include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_thread.h" +#include "content/test/test_content_browser_client.h" #include "content/test/test_content_client.h" #include "googleurl/src/url_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -81,7 +81,7 @@ class SiteInstanceTestClient : public TestContentClient { }; class SiteInstanceTestBrowserClient : - public content::MockContentBrowserClient { + public content::TestContentBrowserClient { public: SiteInstanceTestBrowserClient() : privileged_process_id_(-1) { @@ -127,13 +127,13 @@ class SiteInstanceTest : public testing::Test { old_client_ = content::GetContentClient(); old_browser_client_ = content::GetContentClient()->browser(); content::SetContentClient(&client_); - content::GetContentClient()->set_browser(&browser_client_); + content::GetContentClient()->set_browser_for_testing(&browser_client_); url_util::AddStandardScheme(kPrivilegedScheme); url_util::AddStandardScheme(chrome::kChromeUIScheme); } virtual void TearDown() { - content::GetContentClient()->set_browser(old_browser_client_); + content::GetContentClient()->set_browser_for_testing(old_browser_client_); content::SetContentClient(old_client_); MessageLoop::current()->RunAllPending(); message_loop_.RunAllPending(); diff --git a/content/browser/web_contents/render_view_host_manager_unittest.cc b/content/browser/web_contents/render_view_host_manager_unittest.cc index fd94166..25705d7 100644 --- a/content/browser/web_contents/render_view_host_manager_unittest.cc +++ b/content/browser/web_contents/render_view_host_manager_unittest.cc @@ -4,7 +4,6 @@ #include "base/utf_string_conversions.h" #include "content/browser/browser_thread_impl.h" -#include "content/browser/mock_content_browser_client.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance_impl.h" #include "content/browser/web_contents/navigation_controller_impl.h" @@ -24,6 +23,7 @@ #include "content/public/test/mock_render_process_host.h" #include "content/public/test/test_browser_context.h" #include "content/public/test/test_notification_tracker.h" +#include "content/test/test_content_browser_client.h" #include "content/test/test_content_client.h" #include "googleurl/src/url_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -108,7 +108,7 @@ class RenderViewHostManagerTestClient : public TestContentClient { }; class RenderViewHostManagerTestBrowserClient - : public content::MockContentBrowserClient { + : public content::TestContentBrowserClient { public: RenderViewHostManagerTestBrowserClient() {} virtual ~RenderViewHostManagerTestBrowserClient() {} @@ -117,7 +117,7 @@ class RenderViewHostManagerTestBrowserClient factory_.set_should_create_webui(should_create_webui); } - // content::MockContentBrowserClient implementation. + // content::TestContentBrowserClient implementation. virtual content::WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE { return &factory_; @@ -139,13 +139,13 @@ class RenderViewHostManagerTest old_client_ = content::GetContentClient(); old_browser_client_ = content::GetContentClient()->browser(); content::SetContentClient(&client_); - content::GetContentClient()->set_browser(&browser_client_); + content::GetContentClient()->set_browser_for_testing(&browser_client_); url_util::AddStandardScheme(chrome::kChromeUIScheme); } virtual void TearDown() OVERRIDE { RenderViewHostImplTestHarness::TearDown(); - content::GetContentClient()->set_browser(old_browser_client_); + content::GetContentClient()->set_browser_for_testing(old_browser_client_); content::SetContentClient(old_client_); } diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index f40285f..77559e6 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -4,7 +4,6 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" -#include "content/browser/mock_content_browser_client.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance_impl.h" @@ -25,6 +24,7 @@ #include "content/public/common/url_constants.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/test_browser_thread.h" +#include "content/test/test_content_browser_client.h" #include "content/test/test_content_client.h" #include "googleurl/src/url_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -94,7 +94,7 @@ class WebContentsImplTestContentClient : public TestContentClient { }; class WebContentsImplTestBrowserClient - : public content::MockContentBrowserClient { + : public content::TestContentBrowserClient { public: WebContentsImplTestBrowserClient() { } @@ -289,12 +289,12 @@ class WebContentsImplTest : public RenderViewHostImplTestHarness { old_client_ = content::GetContentClient(); old_browser_client_ = content::GetContentClient()->browser(); content::SetContentClient(&client_); - content::GetContentClient()->set_browser(&browser_client_); + content::GetContentClient()->set_browser_for_testing(&browser_client_); RenderViewHostImplTestHarness::SetUp(); } virtual void TearDown() { - content::GetContentClient()->set_browser(old_browser_client_); + content::GetContentClient()->set_browser_for_testing(old_browser_client_); content::SetContentClient(old_client_); RenderViewHostImplTestHarness::TearDown(); } diff --git a/content/content_shell.gypi b/content/content_shell.gypi index 8fc69ca..588723e 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -70,12 +70,8 @@ 'shell/shell_content_browser_client.h', 'shell/shell_content_client.cc', 'shell/shell_content_client.h', - 'shell/shell_content_plugin_client.cc', - 'shell/shell_content_plugin_client.h', 'shell/shell_content_renderer_client.cc', 'shell/shell_content_renderer_client.h', - 'shell/shell_content_utility_client.cc', - 'shell/shell_content_utility_client.h', 'shell/shell_devtools_delegate.cc', 'shell/shell_devtools_delegate.h', 'shell/shell_download_manager_delegate.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index bde98e2..9784a97 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -58,8 +58,6 @@ 'browser/geolocation/fake_access_token_store.h', 'browser/geolocation/mock_location_provider.cc', 'browser/geolocation/mock_location_provider.h', - 'browser/mock_content_browser_client.cc', - 'browser/mock_content_browser_client.h', 'browser/renderer_host/media/mock_media_observer.cc', 'browser/renderer_host/media/mock_media_observer.h', 'browser/renderer_host/test_backing_store.cc', @@ -102,6 +100,8 @@ 'test/render_view_test.cc', 'test/test_browser_context.cc', 'test/test_browser_thread.cc', + 'test/test_content_browser_client.cc', + 'test/test_content_browser_client.h', 'test/test_content_client.cc', 'test/test_content_client.h', 'test/test_content_client_initializer.cc', diff --git a/content/public/DEPS b/content/public/DEPS index b790400..7358adb 100644 --- a/content/public/DEPS +++ b/content/public/DEPS @@ -5,5 +5,5 @@ include_rules = [ # included directly by embedders of content/. It must however be # available to code in content/public. "+content/common/content_export.h", - "+content/public", + "+content/public/common", ] diff --git a/content/public/app/DEPS b/content/public/app/DEPS new file mode 100644 index 0000000..255cb72 --- /dev/null +++ b/content/public/app/DEPS @@ -0,0 +1,6 @@ +include_rules = [ + "+content/public/browser/content_browser_client.h", + "+content/public/plugin/content_plugin_client.h", + "+content/public/renderer/content_renderer_client.h", + "+content/public/utility/content_utility_client.h", +] diff --git a/content/public/app/content_main_delegate.cc b/content/public/app/content_main_delegate.cc index b8e6a6c..51a6742 100644 --- a/content/public/app/content_main_delegate.cc +++ b/content/public/app/content_main_delegate.cc @@ -4,6 +4,11 @@ #include "content/public/app/content_main_delegate.h" +#include "content/public/browser/content_browser_client.h" +#include "content/public/plugin/content_plugin_client.h" +#include "content/public/renderer/content_renderer_client.h" +#include "content/public/utility/content_utility_client.h" + namespace content { bool ContentMainDelegate::BasicStartupComplete(int* exit_code) { @@ -40,4 +45,20 @@ ZygoteForkDelegate* ContentMainDelegate::ZygoteStarting() { #endif +ContentBrowserClient* ContentMainDelegate::CreateContentBrowserClient() { + return new ContentBrowserClient(); +} + +ContentPluginClient* ContentMainDelegate::CreateContentPluginClient() { + return new ContentPluginClient(); +} + +ContentRendererClient* ContentMainDelegate::CreateContentRendererClient() { + return new ContentRendererClient(); +} + +ContentUtilityClient* ContentMainDelegate::CreateContentUtilityClient() { + return new ContentUtilityClient(); +} + } // namespace content diff --git a/content/public/app/content_main_delegate.h b/content/public/app/content_main_delegate.h index f98130c..e0db578 100644 --- a/content/public/app/content_main_delegate.h +++ b/content/public/app/content_main_delegate.h @@ -13,6 +13,10 @@ namespace content { +class ContentBrowserClient; +class ContentPluginClient; +class ContentRendererClient; +class ContentUtilityClient; class ZygoteForkDelegate; struct MainFunctionParams; @@ -68,6 +72,17 @@ class CONTENT_EXPORT ContentMainDelegate { // Called every time the zygote process forks. virtual void ZygoteForked() {} #endif // OS_MACOSX + + protected: + friend class ContentClientInitializer; + + // Called once per relevant process type to allow the embedder to customize + // content. If an embedder wants the default (empty) implementation, don't + // override this. + virtual ContentBrowserClient* CreateContentBrowserClient(); + virtual ContentPluginClient* CreateContentPluginClient(); + virtual ContentRendererClient* CreateContentRendererClient(); + virtual ContentUtilityClient* CreateContentUtilityClient(); }; } // namespace content diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index d8f0e9c..3a0a825 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -81,6 +81,8 @@ typedef base::Callback< void(const MediaStreamDevices&) > MediaResponseCallback; // the observer interfaces.) class CONTENT_EXPORT ContentBrowserClient { public: + virtual ~ContentBrowserClient() {} + // Allows the embedder to set any number of custom BrowserMainParts // implementations for the browser startup code. See comments in // browser_main_parts.h. @@ -422,9 +424,6 @@ class CONTENT_EXPORT ContentBrowserClient { crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( const GURL& url); #endif - - protected: - virtual ~ContentBrowserClient() {} }; } // namespace content diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h index c4cbe82..4573edf 100644 --- a/content/public/common/content_client.h +++ b/content/public/common/content_client.h @@ -73,13 +73,9 @@ class CONTENT_EXPORT ContentClient { virtual ~ContentClient(); ContentBrowserClient* browser() { return browser_; } - void set_browser(ContentBrowserClient* c) { browser_ = c; } ContentPluginClient* plugin() { return plugin_; } - void set_plugin(ContentPluginClient* p) { plugin_ = p; } ContentRendererClient* renderer() { return renderer_; } - void set_renderer(ContentRendererClient* r) { renderer_ = r; } ContentUtilityClient* utility() { return utility_; } - void set_utility(ContentUtilityClient* u) { utility_ = u; } // Sets the currently active URL. Use GURL() to clear the URL. virtual void SetActiveURL(const GURL& url) {} @@ -139,7 +135,12 @@ class CONTENT_EXPORT ContentClient { int* sandbox_profile_resource_id) const; #endif + void set_browser_for_testing(ContentBrowserClient* c) { browser_ = c; } + void set_renderer_for_testing(ContentRendererClient* r) { renderer_ = r; } + private: + friend class ContentClientInitializer; // To set these pointers. + // The embedder API for participating in browser logic. ContentBrowserClient* browser_; // The embedder API for participating in plugin logic. diff --git a/content/public/plugin/content_plugin_client.h b/content/public/plugin/content_plugin_client.h index 499579a..96cb641 100644 --- a/content/public/plugin/content_plugin_client.h +++ b/content/public/plugin/content_plugin_client.h @@ -14,11 +14,10 @@ namespace content { // Embedder API for participating in plugin logic. class CONTENT_EXPORT ContentPluginClient { public: + virtual ~ContentPluginClient() {} + // Notifies that a plugin process has started. virtual void PluginProcessStarted(const string16& plugin_name) {} - - protected: - virtual ~ContentPluginClient() {} }; } // namespace content diff --git a/content/public/test/test_content_client_initializer.h b/content/public/test/test_content_client_initializer.h index 40ccd54..2e2af48 100644 --- a/content/public/test/test_content_client_initializer.h +++ b/content/public/test/test_content_client_initializer.h @@ -14,8 +14,8 @@ class NotificationServiceImpl; namespace content { class ContentClient; -class MockContentBrowserClient; class MockRenderProcessHostFactory; +class TestContentBrowserClient; class TestRenderViewHostFactory; // Initializes various objects needed to run unit tests that use content:: @@ -34,7 +34,7 @@ class TestContentClientInitializer { private: scoped_ptr<NotificationServiceImpl> notification_service_; scoped_ptr<ContentClient> content_client_; - scoped_ptr<MockContentBrowserClient> content_browser_client_; + scoped_ptr<TestContentBrowserClient> content_browser_client_; scoped_ptr<content::MockRenderProcessHostFactory> rph_factory_; scoped_ptr<TestRenderViewHostFactory> test_render_view_host_factory_; diff --git a/content/renderer/mock_content_renderer_client.cc b/content/renderer/mock_content_renderer_client.cc deleted file mode 100644 index 664aff1..0000000 --- a/content/renderer/mock_content_renderer_client.cc +++ /dev/null @@ -1,145 +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 "content/renderer/mock_content_renderer_client.h" - -#include <string> -#include "v8/include/v8.h" - -namespace content { - -MockContentRendererClient::~MockContentRendererClient() { -} - -void MockContentRendererClient::RenderThreadStarted() { -} - -void MockContentRendererClient::RenderViewCreated(RenderView* render_view) { -} - -void MockContentRendererClient::SetNumberOfViews(int number_of_views) { -} - -SkBitmap* MockContentRendererClient::GetSadPluginBitmap() { - return NULL; -} - -std::string MockContentRendererClient::GetDefaultEncoding() { - return std::string(); -} - -bool MockContentRendererClient::OverrideCreatePlugin( - RenderView* render_view, - WebKit::WebFrame* frame, - const WebKit::WebPluginParams& params, - WebKit::WebPlugin** plugin) { - return false; -} - -WebKit::WebPlugin* MockContentRendererClient::CreatePluginReplacement( - RenderView* render_view, - const FilePath& plugin_path) { - return NULL; -} - -bool MockContentRendererClient::HasErrorPage(int http_status_code, - std::string* error_domain) { - return false; -} - -webkit_media::WebMediaPlayerImpl* -MockContentRendererClient::OverrideCreateWebMediaPlayer( - RenderView* render_view, - WebKit::WebFrame* frame, - WebKit::WebMediaPlayerClient* client, - base::WeakPtr<webkit_media::WebMediaPlayerDelegate> delegate, - media::FilterCollection* collection, - WebKit::WebAudioSourceProvider* audio_source_provider, - media::MessageLoopFactory* message_loop_factory, - webkit_media::MediaStreamClient* media_stream_client, - media::MediaLog* media_log) { - return NULL; -} - -void MockContentRendererClient::GetNavigationErrorStrings( - const WebKit::WebURLRequest& failed_request, - const WebKit::WebURLError& error, - std::string* error_html, - string16* error_description) { -} - -bool MockContentRendererClient::RunIdleHandlerWhenWidgetsHidden() { - return true; -} - -bool MockContentRendererClient::AllowPopup(const GURL& creator) { - return false; -} - -bool MockContentRendererClient::ShouldFork(WebKit::WebFrame* frame, - const GURL& url, - bool is_initial_navigation, - bool* send_referrer) { - return false; -} - -bool MockContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, - const GURL& url, - GURL* new_url) { - return false; -} - -bool MockContentRendererClient::ShouldPumpEventsDuringCookieMessage() { - return false; -} - -void MockContentRendererClient::DidCreateScriptContext( - WebKit::WebFrame* frame, v8::Handle<v8::Context> context, - int extension_group, int world_id) { -} - -void MockContentRendererClient::WillReleaseScriptContext( - WebKit::WebFrame* frame, v8::Handle<v8::Context> context, int world_id) { -} - -unsigned long long MockContentRendererClient::VisitedLinkHash( - const char* canonical_url, size_t length) { - return 0LL; -} - -bool MockContentRendererClient::IsLinkVisited(unsigned long long link_hash) { - return false; -} - -void MockContentRendererClient::PrefetchHostName( - const char* hostname, size_t length) { -} - -bool MockContentRendererClient::ShouldOverridePageVisibilityState( - const RenderView* render_view, - WebKit::WebPageVisibilityState* override_state) const { - return false; -} - -bool MockContentRendererClient::HandleGetCookieRequest( - RenderView* sender, - const GURL& url, - const GURL& first_party_for_cookies, - std::string* cookies) { - return false; -} - -bool MockContentRendererClient::HandleSetCookieRequest( - RenderView* sender, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& value) { - return false; -} - -void MockContentRendererClient::RegisterPPAPIInterfaceFactories( - webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { -} - -} // namespace content diff --git a/content/renderer/mock_content_renderer_client.h b/content/renderer/mock_content_renderer_client.h deleted file mode 100644 index 82fae79..0000000 --- a/content/renderer/mock_content_renderer_client.h +++ /dev/null @@ -1,88 +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 CONTENT_RENDERER_MOCK_CONTENT_RENDERER_CLIENT_H_ -#define CONTENT_RENDERER_MOCK_CONTENT_RENDERER_CLIENT_H_ -#pragma once - -#include <string> - -#include "base/compiler_specific.h" -#include "content/public/renderer/content_renderer_client.h" - -namespace content { - -// Base class for unit tests that need to mock the ContentRendererClient. -class MockContentRendererClient : public ContentRendererClient { - public: - virtual ~MockContentRendererClient(); - virtual void RenderThreadStarted() OVERRIDE; - virtual void RenderViewCreated(RenderView* render_view) OVERRIDE; - virtual void SetNumberOfViews(int number_of_views) OVERRIDE; - virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; - virtual std::string GetDefaultEncoding() OVERRIDE; - virtual bool OverrideCreatePlugin( - RenderView* render_view, - WebKit::WebFrame* frame, - const WebKit::WebPluginParams& params, - WebKit::WebPlugin** plugin) OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - RenderView* render_view, - const FilePath& plugin_path) OVERRIDE; - virtual bool HasErrorPage(int http_status_code, - std::string* error_domain) OVERRIDE; - virtual void GetNavigationErrorStrings( - const WebKit::WebURLRequest& failed_request, - const WebKit::WebURLError& error, - std::string* error_html, - string16* error_description) OVERRIDE; - virtual webkit_media::WebMediaPlayerImpl* OverrideCreateWebMediaPlayer( - RenderView* render_view, - WebKit::WebFrame* frame, - WebKit::WebMediaPlayerClient* client, - base::WeakPtr<webkit_media::WebMediaPlayerDelegate> delegate, - media::FilterCollection* collection, - WebKit::WebAudioSourceProvider* audio_source_provider, - media::MessageLoopFactory* message_loop_factory, - webkit_media::MediaStreamClient* media_stream_client, - media::MediaLog* media_log) OVERRIDE; - virtual bool RunIdleHandlerWhenWidgetsHidden() OVERRIDE; - virtual bool AllowPopup(const GURL& creator) OVERRIDE; - virtual bool ShouldFork(WebKit::WebFrame* frame, - const GURL& url, - bool is_initial_navigation, - bool* send_referrer) OVERRIDE; - virtual bool WillSendRequest(WebKit::WebFrame* frame, - const GURL& url, - GURL* new_url) OVERRIDE; - virtual bool ShouldPumpEventsDuringCookieMessage() OVERRIDE; - virtual void DidCreateScriptContext(WebKit::WebFrame* frame, - v8::Handle<v8::Context> context, - int extension_group, - int world_id) OVERRIDE; - virtual void WillReleaseScriptContext(WebKit::WebFrame* frame, - v8::Handle<v8::Context> context, - int world_id) OVERRIDE; - virtual unsigned long long VisitedLinkHash(const char* canonical_url, - size_t length) OVERRIDE; - virtual bool IsLinkVisited(unsigned long long link_hash) OVERRIDE; - virtual void PrefetchHostName(const char* hostname, size_t length) OVERRIDE; - virtual bool ShouldOverridePageVisibilityState( - const RenderView* render_view, - WebKit::WebPageVisibilityState* override_state) const OVERRIDE; - virtual bool HandleGetCookieRequest(RenderView* sender, - const GURL& url, - const GURL& first_party_for_cookies, - std::string* cookies) OVERRIDE; - virtual bool HandleSetCookieRequest(RenderView* sender, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& value) OVERRIDE; - virtual void RegisterPPAPIInterfaceFactories( - webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) OVERRIDE; -}; - -} // namespace content - -#endif // CONTENT_RENDERER_MOCK_CONTENT_RENDERER_CLIENT_H_ diff --git a/content/shell/shell_content_plugin_client.cc b/content/shell/shell_content_plugin_client.cc deleted file mode 100644 index b2b6c7d..0000000 --- a/content/shell/shell_content_plugin_client.cc +++ /dev/null @@ -1,12 +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. - -#include "content/shell/shell_content_plugin_client.h" - -namespace content { - -ShellContentPluginClient::~ShellContentPluginClient() { -} - -} // namespace content diff --git a/content/shell/shell_content_plugin_client.h b/content/shell/shell_content_plugin_client.h deleted file mode 100644 index f35937a..0000000 --- a/content/shell/shell_content_plugin_client.h +++ /dev/null @@ -1,21 +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 CONTENT_SHELL_SHELL_CONTENT_PLUGIN_CLIENT_H_ -#define CONTENT_SHELL_SHELL_CONTENT_PLUGIN_CLIENT_H_ -#pragma once - -#include "base/compiler_specific.h" -#include "content/public/plugin/content_plugin_client.h" - -namespace content { - -class ShellContentPluginClient : public ContentPluginClient { - public: - virtual ~ShellContentPluginClient(); -}; - -} // namespace content - -#endif // CONTENT_SHELL_SHELL_CONTENT_PLUGIN_CLIENT_H_ diff --git a/content/shell/shell_content_utility_client.cc b/content/shell/shell_content_utility_client.cc deleted file mode 100644 index fb2a285..0000000 --- a/content/shell/shell_content_utility_client.cc +++ /dev/null @@ -1,19 +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. - -#include "content/shell/shell_content_utility_client.h" - -namespace content { - -ShellContentUtilityClient::~ShellContentUtilityClient() { -} - -void ShellContentUtilityClient::UtilityThreadStarted() { -} - -bool ShellContentUtilityClient::OnMessageReceived(const IPC::Message& message) { - return false; -} - -} // namespace content diff --git a/content/shell/shell_content_utility_client.h b/content/shell/shell_content_utility_client.h deleted file mode 100644 index 051298a..0000000 --- a/content/shell/shell_content_utility_client.h +++ /dev/null @@ -1,23 +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 CONTENT_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_ -#define CONTENT_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_ -#pragma once - -#include "base/compiler_specific.h" -#include "content/public/utility/content_utility_client.h" - -namespace content { - - class ShellContentUtilityClient : public ContentUtilityClient { - public: - virtual ~ShellContentUtilityClient(); - virtual void UtilityThreadStarted() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; -}; - -} // namespace content - -#endif // CONTENT_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_ diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc index 469e779..f2ae251 100644 --- a/content/shell/shell_main_delegate.cc +++ b/content/shell/shell_main_delegate.cc @@ -11,9 +11,7 @@ #include "content/public/common/url_constants.h" #include "content/shell/shell_browser_main.h" #include "content/shell/shell_content_browser_client.h" -#include "content/shell/shell_content_plugin_client.h" #include "content/shell/shell_content_renderer_client.h" -#include "content/shell/shell_content_utility_client.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" @@ -34,12 +32,7 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { #if defined(OS_MACOSX) OverrideFrameworkBundlePath(); #endif - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); content::SetContentClient(&content_client_); - InitializeShellContentClient(process_type); - return false; } @@ -59,35 +52,6 @@ int ShellMainDelegate::RunProcess( return ShellBrowserMain(main_function_params); } -#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) -void ShellMainDelegate::ZygoteForked() { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); - InitializeShellContentClient(process_type); -} -#endif - -void ShellMainDelegate::InitializeShellContentClient( - const std::string& process_type) { - if (process_type.empty()) { - browser_client_.reset(new content::ShellContentBrowserClient); - content::GetContentClient()->set_browser(browser_client_.get()); - } - - if (process_type == switches::kRendererProcess || - CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) { - renderer_client_.reset(new content::ShellContentRendererClient); - content::GetContentClient()->set_renderer(renderer_client_.get()); - } else if (process_type == switches::kPluginProcess) { - plugin_client_.reset(new content::ShellContentPluginClient); - content::GetContentClient()->set_plugin(plugin_client_.get()); - } else if (process_type == switches::kUtilityProcess) { - utility_client_.reset(new content::ShellContentUtilityClient); - content::GetContentClient()->set_utility(utility_client_.get()); - } -} - void ShellMainDelegate::InitializeResourceBundle() { FilePath pak_file; #if defined(OS_MACOSX) @@ -106,3 +70,14 @@ void ShellMainDelegate::InitializeResourceBundle() { #endif ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file); } + +content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { + browser_client_.reset(new content::ShellContentBrowserClient); + return browser_client_.get(); +} + +content::ContentRendererClient* + ShellMainDelegate::CreateContentRendererClient() { + renderer_client_.reset(new content::ShellContentRendererClient); + return renderer_client_.get(); +} diff --git a/content/shell/shell_main_delegate.h b/content/shell/shell_main_delegate.h index d3b07d4..a36dbcc 100644 --- a/content/shell/shell_main_delegate.h +++ b/content/shell/shell_main_delegate.h @@ -14,8 +14,6 @@ namespace content { class ShellContentBrowserClient; class ShellContentRendererClient; -class ShellContentPluginClient; -class ShellContentUtilityClient; } // namespace content class ShellMainDelegate : public content::ContentMainDelegate { @@ -23,23 +21,21 @@ class ShellMainDelegate : public content::ContentMainDelegate { ShellMainDelegate(); virtual ~ShellMainDelegate(); + // content::ContentMainDelegate implementation: virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; virtual void PreSandboxStartup() OVERRIDE; virtual int RunProcess( const std::string& process_type, const content::MainFunctionParams& main_function_params) OVERRIDE; -#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) - virtual void ZygoteForked() OVERRIDE; -#endif + virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; + virtual content::ContentRendererClient* + CreateContentRendererClient() OVERRIDE; private: - void InitializeShellContentClient(const std::string& process_type); void InitializeResourceBundle(); scoped_ptr<content::ShellContentBrowserClient> browser_client_; scoped_ptr<content::ShellContentRendererClient> renderer_client_; - scoped_ptr<content::ShellContentPluginClient> plugin_client_; - scoped_ptr<content::ShellContentUtilityClient> utility_client_; content::ShellContentClient content_client_; DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc index 6b785aa..1fc9d35 100644 --- a/content/test/content_test_suite.cc +++ b/content/test/content_test_suite.cc @@ -5,7 +5,6 @@ #include "content/test/content_test_suite.h" #include "base/logging.h" -#include "content/browser/mock_content_browser_client.h" #include "content/public/test/test_content_client_initializer.h" #include "content/test/test_content_client.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/test/render_view_fake_resources_test.cc b/content/test/render_view_fake_resources_test.cc index 4ba5108..53c431a 100644 --- a/content/test/render_view_fake_resources_test.cc +++ b/content/test/render_view_fake_resources_test.cc @@ -57,7 +57,7 @@ void RenderViewFakeResourcesTest::SetUp() { // but we use a real RenderThread so that we can use the ResourceDispatcher // to fetch network resources. These are then served canned content // in OnRequestResource(). - GetContentClient()->set_renderer(&content_renderer_client_); + GetContentClient()->set_renderer_for_testing(&content_renderer_client_); // Generate a unique channel id so that multiple instances of the test can // run in parallel. std::string channel_id = IPC::Channel::GenerateVerifiedChannelID( diff --git a/content/test/render_view_test.cc b/content/test/render_view_test.cc index bc216acd..c8e8425 100644 --- a/content/test/render_view_test.cc +++ b/content/test/render_view_test.cc @@ -124,7 +124,7 @@ void RenderViewTest::SetUp() { // Subclasses can set the ContentClient's renderer before calling // RenderViewTest::SetUp(). if (!GetContentClient()->renderer()) - GetContentClient()->set_renderer(&content_renderer_client_); + GetContentClient()->set_renderer_for_testing(&content_renderer_client_); // Subclasses can set render_thread_ with their own implementation before // calling RenderViewTest::SetUp(). diff --git a/content/browser/mock_content_browser_client.cc b/content/test/test_content_browser_client.cc index e0230ba..e06bff3 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/test/test_content_browser_client.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/mock_content_browser_client.h" +#include "content/test/test_content_browser_client.h" #include <string> @@ -15,13 +15,13 @@ namespace content { -MockContentBrowserClient::MockContentBrowserClient() { +TestContentBrowserClient::TestContentBrowserClient() { } -MockContentBrowserClient::~MockContentBrowserClient() { +TestContentBrowserClient::~TestContentBrowserClient() { } -WebContentsView* MockContentBrowserClient::OverrideCreateWebContentsView( +WebContentsView* TestContentBrowserClient::OverrideCreateWebContentsView( WebContents* web_contents, RenderViewHostDelegateView** render_view_host_delegate_view) { TestWebContentsView* rv = new TestWebContentsView; @@ -29,7 +29,7 @@ WebContentsView* MockContentBrowserClient::OverrideCreateWebContentsView( return rv; } -FilePath MockContentBrowserClient::GetDefaultDownloadDirectory() { +FilePath TestContentBrowserClient::GetDefaultDownloadDirectory() { if (!download_dir_.IsValid()) { bool result = download_dir_.CreateUniqueTempDir(); CHECK(result); diff --git a/content/browser/mock_content_browser_client.h b/content/test/test_content_browser_client.h index b497a87..b376c57 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/test/test_content_browser_client.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ -#define CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ +#ifndef CONTENT_TEST_TEST_CONTENT_BROWSER_CLIENT_H_ +#define CONTENT_TEST_TEST_CONTENT_BROWSER_CLIENT_H_ #pragma once #include <string> @@ -15,11 +15,11 @@ namespace content { -// Base for unit tests that need to mock the ContentBrowserClient. -class MockContentBrowserClient : public ContentBrowserClient { +// Base for unit tests that need a ContentBrowserClient. +class TestContentBrowserClient : public ContentBrowserClient { public: - MockContentBrowserClient(); - virtual ~MockContentBrowserClient(); + TestContentBrowserClient(); + virtual ~TestContentBrowserClient(); virtual WebContentsView* OverrideCreateWebContentsView( WebContents* web_contents, @@ -30,9 +30,9 @@ class MockContentBrowserClient : public ContentBrowserClient { // Temporary directory for GetDefaultDownloadDirectory. ScopedTempDir download_dir_; - DISALLOW_COPY_AND_ASSIGN(MockContentBrowserClient); + DISALLOW_COPY_AND_ASSIGN(TestContentBrowserClient); }; } // namespace content -#endif // CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ +#endif // CONTENT_TEST_TEST_CONTENT_BROWSER_CLIENT_H_ diff --git a/content/test/test_content_client_initializer.cc b/content/test/test_content_client_initializer.cc index 8783272..59a54fe 100644 --- a/content/test/test_content_client_initializer.cc +++ b/content/test/test_content_client_initializer.cc @@ -4,10 +4,10 @@ #include "content/public/test/test_content_client_initializer.h" -#include "content/browser/mock_content_browser_client.h" #include "content/browser/notification_service_impl.h" #include "content/public/common/content_client.h" #include "content/public/test/mock_render_process_host.h" +#include "content/test/test_content_browser_client.h" #include "content/test/test_content_client.h" #include "content/test/test_render_view_host_factory.h" @@ -20,8 +20,8 @@ TestContentClientInitializer::TestContentClientInitializer() { content_client_.reset(new TestContentClient); SetContentClient(content_client_.get()); - content_browser_client_.reset(new MockContentBrowserClient()); - content_client_->set_browser(content_browser_client_.get()); + content_browser_client_.reset(new TestContentBrowserClient()); + content_client_->set_browser_for_testing(content_browser_client_.get()); } TestContentClientInitializer::~TestContentClientInitializer() { diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc index 6826daa..70d829c 100644 --- a/content/test/webrtc_audio_device_test.cc +++ b/content/test/webrtc_audio_device_test.cc @@ -68,11 +68,11 @@ class ReplaceContentClientRenderer { explicit ReplaceContentClientRenderer( content::ContentRendererClient* new_renderer) { saved_renderer_ = content::GetContentClient()->renderer(); - content::GetContentClient()->set_renderer(new_renderer); + content::GetContentClient()->set_renderer_for_testing(new_renderer); } ~ReplaceContentClientRenderer() { // Restore the original renderer. - content::GetContentClient()->set_renderer(saved_renderer_); + content::GetContentClient()->set_renderer_for_testing(saved_renderer_); } private: content::ContentRendererClient* saved_renderer_; @@ -123,7 +123,7 @@ void WebRTCAudioDeviceTest::SetUp() { // Main parts are inspired by the RenderViewFakeResourcesTest. // Note that, the IPC part is not utilized in this test. saved_content_renderer_.reset( - new ReplaceContentClientRenderer(&mock_content_renderer_client_)); + new ReplaceContentClientRenderer(&content_renderer_client_)); mock_process_.reset(new WebRTCMockRenderProcess()); ui_thread_.reset(new content::TestBrowserThread(content::BrowserThread::UI, MessageLoop::current())); diff --git a/content/test/webrtc_audio_device_test.h b/content/test/webrtc_audio_device_test.h index 1e136f2..c0f9954 100644 --- a/content/test/webrtc_audio_device_test.h +++ b/content/test/webrtc_audio_device_test.h @@ -13,7 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "content/browser/renderer_host/media/mock_media_observer.h" -#include "content/renderer/mock_content_renderer_client.h" +#include "content/public/renderer/content_renderer_client.h" #include "media/base/channel_layout.h" #include "ipc/ipc_channel.h" #include "testing/gtest/include/gtest/gtest.h" @@ -164,7 +164,7 @@ class WebRTCAudioDeviceTest scoped_ptr<ReplaceContentClientRenderer> saved_content_renderer_; MessageLoopForUI message_loop_; - content::MockContentRendererClient mock_content_renderer_client_; + content::ContentRendererClient content_renderer_client_; RenderThreadImpl* render_thread_; // Owned by mock_process_. scoped_ptr<WebRTCMockRenderProcess> mock_process_; scoped_ptr<MockMediaObserver> media_observer_; diff --git a/ui/views/examples/content_client/examples_main_delegate.cc b/ui/views/examples/content_client/examples_main_delegate.cc index 3a2a458..1883ed0 100644 --- a/ui/views/examples/content_client/examples_main_delegate.cc +++ b/ui/views/examples/content_client/examples_main_delegate.cc @@ -11,9 +11,6 @@ #include "base/logging.h" #include "base/path_service.h" #include "content/public/common/content_switches.h" -#include "content/shell/shell_content_plugin_client.h" -#include "content/shell/shell_content_renderer_client.h" -#include "content/shell/shell_content_utility_client.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/views/examples/content_client/examples_content_browser_client.h" @@ -47,7 +44,6 @@ bool ExamplesMainDelegate::BasicStartupComplete(int* exit_code) { command_line.GetSwitchValueASCII(switches::kProcessType); content::SetContentClient(&content_client_); - InitializeShellContentClient(process_type); bool success = logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, @@ -66,30 +62,10 @@ void ExamplesMainDelegate::PreSandboxStartup() { InitializeResourceBundle(); } -#if defined(OS_POSIX) -void ExamplesMainDelegate::ZygoteForked() { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); - InitializeShellContentClient(process_type); -} -#endif - -void ExamplesMainDelegate::InitializeShellContentClient( - const std::string& process_type) { - if (process_type.empty()) { - browser_client_.reset(new ExamplesContentBrowserClient); - content::GetContentClient()->set_browser(browser_client_.get()); - } else if (process_type == switches::kRendererProcess) { - renderer_client_.reset(new content::ShellContentRendererClient); - content::GetContentClient()->set_renderer(renderer_client_.get()); - } else if (process_type == switches::kPluginProcess) { - plugin_client_.reset(new content::ShellContentPluginClient); - content::GetContentClient()->set_plugin(plugin_client_.get()); - } else if (process_type == switches::kUtilityProcess) { - utility_client_.reset(new content::ShellContentUtilityClient); - content::GetContentClient()->set_utility(utility_client_.get()); - } +content::ContentBrowserClient* + ExamplesMainDelegate::CreateContentBrowserClient() { + browser_client_.reset(new ExamplesContentBrowserClient); + return browser_client_.get(); } void ExamplesMainDelegate::InitializeResourceBundle() { diff --git a/ui/views/examples/content_client/examples_main_delegate.h b/ui/views/examples/content_client/examples_main_delegate.h index cecb673..750a3ff 100644 --- a/ui/views/examples/content_client/examples_main_delegate.h +++ b/ui/views/examples/content_client/examples_main_delegate.h @@ -14,12 +14,6 @@ #include "content/public/app/content_main_delegate.h" #include "content/shell/shell_content_client.h" -namespace content { -class ShellContentRendererClient; -class ShellContentPluginClient; -class ShellContentUtilityClient; -} - namespace views { namespace examples { @@ -30,20 +24,15 @@ class ExamplesMainDelegate : public content::ContentMainDelegate { ExamplesMainDelegate(); virtual ~ExamplesMainDelegate(); + // content::ContentMainDelegate implementation virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; virtual void PreSandboxStartup() OVERRIDE; -#if defined(OS_POSIX) - virtual void ZygoteForked() OVERRIDE; -#endif // OS_MACOSX + virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; private: - void InitializeShellContentClient(const std::string& process_type); void InitializeResourceBundle(); scoped_ptr<ExamplesContentBrowserClient> browser_client_; - scoped_ptr<content::ShellContentRendererClient> renderer_client_; - scoped_ptr<content::ShellContentPluginClient> plugin_client_; - scoped_ptr<content::ShellContentUtilityClient> utility_client_; content::ShellContentClient content_client_; DISALLOW_COPY_AND_ASSIGN(ExamplesMainDelegate); |