diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 19:57:05 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 19:57:05 +0000 |
commit | 16320ea7fee687b6642f8d9d00a2624f4920bc2e (patch) | |
tree | 5c2ad7861807002f605d3aebed1b8c9dd095513e | |
parent | e121969dd45f75c4a8c09e8cca254f89375ec377 (diff) | |
download | chromium_src-16320ea7fee687b6642f8d9d00a2624f4920bc2e.zip chromium_src-16320ea7fee687b6642f8d9d00a2624f4920bc2e.tar.gz chromium_src-16320ea7fee687b6642f8d9d00a2624f4920bc2e.tar.bz2 |
Move ContentMainDelegate to content/public/.
Mostly a trivial move since the implementation for the class (now
deleted) was do-nothing and the only subclass that didn't have a full
implementation was ShellMainDelegate.
BUG=98716
TEST=it builds + existing tests
Review URL: http://codereview.chromium.org/8356025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106549 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/DEPS | 3 | ||||
-rw-r--r-- | chrome/app/chrome_main_delegate.cc | 2 | ||||
-rw-r--r-- | chrome/app/chrome_main_delegate.h | 2 | ||||
-rw-r--r-- | content/app/content_main.cc | 2 | ||||
-rw-r--r-- | content/app/content_main_delegate.cc | 56 | ||||
-rw-r--r-- | content/content_app.gypi | 3 | ||||
-rw-r--r-- | content/public/app/content_main_delegate.h (renamed from content/app/content_main_delegate.h) | 31 | ||||
-rw-r--r-- | content/shell/shell_main_delegate.cc | 40 | ||||
-rw-r--r-- | content/shell/shell_main_delegate.h | 20 |
9 files changed, 75 insertions, 84 deletions
diff --git a/chrome/app/DEPS b/chrome/app/DEPS index 9525520..d9f9aee 100644 --- a/chrome/app/DEPS +++ b/chrome/app/DEPS @@ -5,7 +5,8 @@ include_rules = [ "+chrome/plugin/chrome_content_plugin_client.h", "+chrome/renderer/chrome_content_renderer_client.h", "+chrome/utility/chrome_content_utility_client.h", - "+content/app", + "+content/app", # TODO(joi): Remove once content API in place. + "+content/public/app", "+content/browser/renderer_host/render_process_host.h", "+grit", # For generated headers "+media/base", # For initializing media library. diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index cfdeb46..1007f00 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -30,10 +30,10 @@ #include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/utility/chrome_content_utility_client.h" #include "content/app/content_main.h" -#include "content/app/content_main_delegate.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/common/content_counters.h" #include "content/common/content_paths.h" +#include "content/public/app/content_main_delegate.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "media/base/media.h" diff --git a/chrome/app/chrome_main_delegate.h b/chrome/app/chrome_main_delegate.h index 978f574..f0a6fe9 100644 --- a/chrome/app/chrome_main_delegate.h +++ b/chrome/app/chrome_main_delegate.h @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "base/metrics/stats_counters.h" #include "chrome/common/chrome_content_client.h" -#include "content/app/content_main_delegate.h" +#include "content/public/app/content_main_delegate.h" // Chrome implementation of ContentMainDelegate. class ChromeMainDelegate : public content::ContentMainDelegate { diff --git a/content/app/content_main.cc b/content/app/content_main.cc index 85d6144..4fdf644 100644 --- a/content/app/content_main.cc +++ b/content/app/content_main.cc @@ -15,7 +15,6 @@ #include "base/process_util.h" #include "base/stringprintf.h" #include "base/string_number_conversions.h" -#include "content/app/content_main_delegate.h" #include "content/app/startup_helper_win.h" #include "content/browser/browser_main.h" #include "content/common/content_constants.h" @@ -23,6 +22,7 @@ #include "content/common/main_function_params.h" #include "content/common/sandbox_init_wrapper.h" #include "content/common/set_process_title.h" +#include "content/public/app/content_main_delegate.h" #include "content/public/common/content_switches.h" #include "crypto/nss_util.h" #include "ipc/ipc_switches.h" diff --git a/content/app/content_main_delegate.cc b/content/app/content_main_delegate.cc deleted file mode 100644 index bf1e266..0000000 --- a/content/app/content_main_delegate.cc +++ /dev/null @@ -1,56 +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/app/content_main_delegate.h" - -#include "base/logging.h" - -namespace content { - -ContentMainDelegate::~ContentMainDelegate() { -} - -bool ContentMainDelegate::BasicStartupComplete(int* exit_code) { - return false; -} - -void ContentMainDelegate::PreSandboxStartup() { -} - -void ContentMainDelegate::SandboxInitialized(const std::string& process_type) { -} - -int ContentMainDelegate::RunProcess(const std::string& process_type, - const MainFunctionParams& main_function_params) { - NOTREACHED(); - return -1; -} - -void ContentMainDelegate::ProcessExiting(const std::string& process_type) { -} - -#if defined(OS_MACOSX) -bool ContentMainDelegate::ProcessRegistersWithSystemProcess( - const std::string& process_type) { - return false; -} - -bool ContentMainDelegate::ShouldSendMachPort(const std::string& process_type) { - return false; -} - -bool ContentMainDelegate::DelaySandboxInitialization( - const std::string& process_type) { - return false; -} -#elif defined(OS_POSIX) -ZygoteForkDelegate* ContentMainDelegate::ZygoteStarting() { - return NULL; -} - -void ContentMainDelegate::ZygoteForked() { -} -#endif // OS_MACOSX - -} // namespace content diff --git a/content/content_app.gypi b/content/content_app.gypi index fe029a1..545080f 100644 --- a/content/content_app.gypi +++ b/content/content_app.gypi @@ -15,10 +15,9 @@ 'sources': [ 'app/content_main.cc', 'app/content_main.h', - 'app/content_main_delegate.cc', - 'app/content_main_delegate.h', 'app/startup_helper_win.cc', 'app/startup_helper_win.h', + 'public/app/content_main_delegate.h', ], 'conditions': [ ['OS=="win"', { diff --git a/content/app/content_main_delegate.h b/content/public/app/content_main_delegate.h index 361afa2..bf424f7 100644 --- a/content/app/content_main_delegate.h +++ b/content/public/app/content_main_delegate.h @@ -2,73 +2,72 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_APP_CONTENT_MAIN_DELEGATE_H_ -#define CONTENT_APP_CONTENT_MAIN_DELEGATE_H_ +#ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_DELEGATE_H_ +#define CONTENT_PUBLIC_APP_CONTENT_MAIN_DELEGATE_H_ #pragma once #include <string> #include "build/build_config.h" -#include "content/common/content_export.h" struct MainFunctionParams; class ZygoteForkDelegate; namespace content { -class CONTENT_EXPORT ContentMainDelegate { +class ContentMainDelegate { public: - virtual ~ContentMainDelegate(); + virtual ~ContentMainDelegate() {} // Tells the embedder that the absolute basic startup has been done, i.e. it's // now safe to create singletons and check the command line. Return true if // the process should exit afterwards, and if so, |exit_code| should be set. // This is the place for embedder to do the things that must happen at the // start. Most of its startup code should be in the methods below. - virtual bool BasicStartupComplete(int* exit_code); + virtual bool BasicStartupComplete(int* exit_code) = 0; // This is where the embedder puts all of its startup code that needs to run // before the sandbox is engaged. - virtual void PreSandboxStartup(); + virtual void PreSandboxStartup() = 0; // This is where the embedder can add startup code to run after the sandbox // has been initialized. - virtual void SandboxInitialized(const std::string& process_type); + virtual void SandboxInitialized(const std::string& process_type) = 0; // Asks the embedder to start a process that content doesn't know about. virtual int RunProcess(const std::string& process_type, - const MainFunctionParams& main_function_params); + const MainFunctionParams& main_function_params) = 0; // Called right before the process exits. - virtual void ProcessExiting(const std::string& process_type); + virtual void ProcessExiting(const std::string& process_type) = 0; #if defined(OS_MACOSX) // Returns true if the process registers with the system monitor, so that we // can allocate an IO port for it before the sandbox is initialized. Embedders // are called only for process types that content doesn't know about. virtual bool ProcessRegistersWithSystemProcess( - const std::string& process_type); + const std::string& process_type) = 0; // Used to determine if we should send the mach port to the parent process or // not. The embedder usually sends it for all child processes, use this to // override this behavior. - virtual bool ShouldSendMachPort(const std::string& process_type); + virtual bool ShouldSendMachPort(const std::string& process_type) = 0; // Allows the embedder to override initializing the sandbox. This is needed // because some processes might not want to enable it right away or might not // want it at all. - virtual bool DelaySandboxInitialization(const std::string& process_type); + virtual bool DelaySandboxInitialization(const std::string& process_type) = 0; #elif defined(OS_POSIX) // Tells the embedder that the zygote process is starting, and allows it to // specify a zygote delegate if it wishes. - virtual ZygoteForkDelegate* ZygoteStarting(); + virtual ZygoteForkDelegate* ZygoteStarting() = 0; // Called every time the zygote process forks. - virtual void ZygoteForked(); + virtual void ZygoteForked() = 0; #endif // OS_MACOSX }; } // namespace content -#endif // CONTENT_APP_CONTENT_MAIN_DELEGATE_H_ +#endif // CONTENT_PUBLIC_APP_CONTENT_MAIN_DELEGATE_H_ diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc index 13dd6da..d77eaf5 100644 --- a/content/shell/shell_main_delegate.cc +++ b/content/shell/shell_main_delegate.cc @@ -17,6 +17,10 @@ ShellMainDelegate::ShellMainDelegate() { ShellMainDelegate::~ShellMainDelegate() { } +bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { + return false; +} + void ShellMainDelegate::PreSandboxStartup() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); std::string process_type = @@ -26,14 +30,46 @@ void ShellMainDelegate::PreSandboxStartup() { InitializeShellContentClient(process_type); } -#if defined(OS_POSIX) && !defined(OS_MACOSX) +void ShellMainDelegate::SandboxInitialized(const std::string& process_type) { +} + +int ShellMainDelegate::RunProcess( + const std::string& process_type, + const MainFunctionParams& main_function_params) { + NOTREACHED(); + return -1; +} + +void ShellMainDelegate::ProcessExiting(const std::string& process_type) { +} + +#if defined(OS_MACOSX) +bool ShellMainDelegate::ProcessRegistersWithSystemProcess( + const std::string& process_type) { + return false; +} + +bool ShellMainDelegate::ShouldSendMachPort(const std::string& process_type) { + return false; +} + +bool ShellMainDelegate::DelaySandboxInitialization( + const std::string& process_type) { + return false; +} + +#elif defined(OS_POSIX) +ZygoteForkDelegate* ShellMainDelegate::ZygoteStarting() { + return NULL; +} + void ShellMainDelegate::ZygoteForked() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); std::string process_type = command_line.GetSwitchValueASCII(switches::kProcessType); InitializeShellContentClient(process_type); } -#endif +#endif // OS_MACOSX void ShellMainDelegate::InitializeShellContentClient( const std::string& process_type) { diff --git a/content/shell/shell_main_delegate.h b/content/shell/shell_main_delegate.h index 4b1b431..a06c2f0 100644 --- a/content/shell/shell_main_delegate.h +++ b/content/shell/shell_main_delegate.h @@ -8,8 +8,8 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "content/app/content_main_delegate.h" #include "content/shell/shell_content_client.h" +#include "content/public/app/content_main_delegate.h" namespace content { class ShellContentBrowserClient; @@ -23,11 +23,23 @@ class ShellMainDelegate : public content::ContentMainDelegate { ShellMainDelegate(); virtual ~ShellMainDelegate(); + virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; virtual void PreSandboxStartup() OVERRIDE; - -#if defined(OS_POSIX) && !defined(OS_MACOSX) + virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; + virtual int RunProcess( + const std::string& process_type, + const 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; + virtual bool ShouldSendMachPort(const std::string& process_type) OVERRIDE; + virtual bool DelaySandboxInitialization( + const std::string& process_type) OVERRIDE; +#elif defined(OS_POSIX) + virtual ZygoteForkDelegate* ZygoteStarting() OVERRIDE; virtual void ZygoteForked() OVERRIDE; -#endif +#endif // OS_MACOSX private: void InitializeShellContentClient(const std::string& process_type); |