summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 22:07:36 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 22:07:36 +0000
commit5629e0c704b4807fd00062c8b91aeea3726fe18d (patch)
tree6bec38454b7f3709729ff1ea3090b5d828777da6
parent434b02a20e5194548f6ab5868b78f14215e3614d (diff)
downloadchromium_src-5629e0c704b4807fd00062c8b91aeea3726fe18d.zip
chromium_src-5629e0c704b4807fd00062c8b91aeea3726fe18d.tar.gz
chromium_src-5629e0c704b4807fd00062c8b91aeea3726fe18d.tar.bz2
Basic scaffolding for a "content shell", i.e. test browser over the content module. Once it's working, this will allow developers working on the core chrome code/web platform/networking etc to test their changes on a much smaller and hence faster to build/run/debug browser.
This doesn't do anything yet because it's blocked on having TabContentsView implementations in content. BUG=90445 Review URL: http://codereview.chromium.org/7857019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100778 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chrome_main.cc4
-rw-r--r--chrome/chrome_browser.gypi1
-rw-r--r--content/app/content_main.cc2
-rw-r--r--content/app/content_main.h2
-rw-r--r--content/app/content_main_delegate.cc56
-rw-r--r--content/app/content_main_delegate.h23
-rw-r--r--content/browser/browser_main.cc2
-rw-r--r--content/common/set_process_title.cc4
-rw-r--r--content/common/set_process_title.h2
-rw-r--r--content/common/set_process_title_linux.cc4
-rw-r--r--content/common/set_process_title_linux.h2
-rw-r--r--content/content.gyp1
-rw-r--r--content/content_app.gypi1
-rw-r--r--content/content_browser.gypi1
-rw-r--r--content/content_shell.gypi55
-rw-r--r--content/shell/DEPS3
-rw-r--r--content/shell/shell_browser_main.cc6
-rw-r--r--content/shell/shell_browser_main.h9
-rw-r--r--content/shell/shell_content_browser_client.cc284
-rw-r--r--content/shell/shell_content_browser_client.h143
-rw-r--r--content/shell/shell_content_client.cc51
-rw-r--r--content/shell/shell_content_client.h36
-rw-r--r--content/shell/shell_content_plugin_client.cc16
-rw-r--r--content/shell/shell_content_plugin_client.h22
-rw-r--r--content/shell/shell_content_renderer_client.cc122
-rw-r--r--content/shell/shell_content_renderer_client.h67
-rw-r--r--content/shell/shell_content_utility_client.cc19
-rw-r--r--content/shell/shell_content_utility_client.h23
-rw-r--r--content/shell/shell_main.cc93
29 files changed, 1033 insertions, 21 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index 8b69e3f..bc50d049 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -114,7 +114,7 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance,
#elif defined(OS_POSIX)
extern "C" {
__attribute__((visibility("default")))
-int ChromeMain(int argc, char** argv);
+int ChromeMain(int argc, const char** argv);
}
#endif
@@ -743,7 +743,7 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance,
ChromeMainDelegate chrome_main_delegate;
return content::ContentMain(instance, sandbox_info, &chrome_main_delegate);
#elif defined(OS_POSIX)
-int ChromeMain(int argc, char** argv) {
+int ChromeMain(int argc, const char** argv) {
ChromeMainDelegate chrome_main_delegate;
return content::ContentMain(argc, argv, &chrome_main_delegate);
#endif
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 0675404..2060863f 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -4116,7 +4116,6 @@
}],
['toolkit_uses_gtk == 1', {
'dependencies': [
- '../build/linux/system.gyp:dbus-glib',
'../build/linux/system.gyp:gconf',
'../build/linux/system.gyp:gtk',
'../build/linux/system.gyp:gtkprint',
diff --git a/content/app/content_main.cc b/content/app/content_main.cc
index e40dca9..9d388a2 100644
--- a/content/app/content_main.cc
+++ b/content/app/content_main.cc
@@ -284,7 +284,7 @@ int ContentMain(HINSTANCE instance,
_Module.Init(NULL, static_cast<HINSTANCE>(instance));
#else
int ContentMain(int argc,
- char** argv,
+ const char** argv,
ContentMainDelegate* delegate) {
// NOTE(willchan): One might ask why this call is done here rather than in
// process_util_linux.cc with the definition of
diff --git a/content/app/content_main.h b/content/app/content_main.h
index 259c813..386902d 100644
--- a/content/app/content_main.h
+++ b/content/app/content_main.h
@@ -33,7 +33,7 @@ int ContentMain(HINSTANCE instance,
ContentMainDelegate* delegate);
#else
int ContentMain(int argc,
- char** argv,
+ const char** argv,
ContentMainDelegate* delegate);
#endif
diff --git a/content/app/content_main_delegate.cc b/content/app/content_main_delegate.cc
new file mode 100644
index 0000000..bf1e266
--- /dev/null
+++ b/content/app/content_main_delegate.cc
@@ -0,0 +1,56 @@
+// 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/app/content_main_delegate.h b/content/app/content_main_delegate.h
index 3e28c5d..aeb9033 100644
--- a/content/app/content_main_delegate.h
+++ b/content/app/content_main_delegate.h
@@ -17,51 +17,54 @@ namespace content {
class ContentMainDelegate {
public:
+ 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) = 0;
+ virtual bool BasicStartupComplete(int* exit_code);
// This is where the embedder puts all of its startup code that needs to run
// before the sandbox is engaged.
- virtual void PreSandboxStartup() = 0;
+ virtual void PreSandboxStartup();
// 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) = 0;
+ virtual void SandboxInitialized(const std::string& process_type);
// 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) = 0;
+ const MainFunctionParams& main_function_params);
// Called right before the process exits.
- virtual void ProcessExiting(const std::string& process_type) = 0;
+ virtual void ProcessExiting(const std::string& process_type);
#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) = 0;
+ const std::string& process_type);
// 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) = 0;
+ virtual bool ShouldSendMachPort(const std::string& process_type);
// 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) = 0;
+ virtual bool DelaySandboxInitialization(const std::string& process_type);
+
#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() = 0;
+ virtual ZygoteForkDelegate* ZygoteStarting();
// Called every time the zygote process forks.
- virtual void ZygoteForked() = 0;
+ virtual void ZygoteForked();
#endif // OS_MACOSX
};
diff --git a/content/browser/browser_main.cc b/content/browser/browser_main.cc
index dd497bf..2e165ec 100644
--- a/content/browser/browser_main.cc
+++ b/content/browser/browser_main.cc
@@ -347,6 +347,8 @@ int BrowserMain(const MainFunctionParams& parameters) {
scoped_ptr<content::BrowserMainParts> parts(
content::GetContentClient()->browser()->CreateBrowserMainParts(
parameters));
+ if (!parts.get())
+ parts.reset(new content::BrowserMainParts(parameters));
parts->EarlyInitialization();
diff --git a/content/common/set_process_title.cc b/content/common/set_process_title.cc
index ddf2dae..4867ec0 100644
--- a/content/common/set_process_title.cc
+++ b/content/common/set_process_title.cc
@@ -25,7 +25,7 @@
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS)
-void SetProcessTitleFromCommandLine(char** main_argv) {
+void SetProcessTitleFromCommandLine(const char** main_argv) {
// Build a single string which consists of all the arguments separated
// by spaces. We can't actually keep them separate due to the way the
// setproctitle() function works.
@@ -74,7 +74,7 @@ void SetProcessTitleFromCommandLine(char** main_argv) {
// All other systems (basically Windows & Mac) have no need or way to implement
// this function.
-void SetProcessTitleFromCommandLine(char** /* main_argv */) {
+void SetProcessTitleFromCommandLine(const char** /* main_argv */) {
}
#endif
diff --git a/content/common/set_process_title.h b/content/common/set_process_title.h
index 8c689c6..3ef935d 100644
--- a/content/common/set_process_title.h
+++ b/content/common/set_process_title.h
@@ -19,6 +19,6 @@
// makes the process name that shows up in "ps" etc. for the child processes
// show as "exe" instead of "chrome" or something reasonable. This function
// will try to fix it so the "effective" command line shows up instead.
-void SetProcessTitleFromCommandLine(char** main_argv);
+void SetProcessTitleFromCommandLine(const char** main_argv);
#endif // CONTENT_COMMON_SET_PROCESS_TITLE_H_
diff --git a/content/common/set_process_title_linux.cc b/content/common/set_process_title_linux.cc
index ada0552..c504380 100644
--- a/content/common/set_process_title_linux.cc
+++ b/content/common/set_process_title_linux.cc
@@ -103,7 +103,7 @@ void setproctitle(const char* fmt, ...) {
// A version of this built into glibc would not need this function, since
// it could stash the argv pointer in __libc_start_main(). But we need it.
-void setproctitle_init(char** main_argv) {
+void setproctitle_init(const char** main_argv) {
if (g_main_argv)
return;
@@ -111,5 +111,5 @@ void setproctitle_init(char** main_argv) {
// Check that the argv array is in fact on the same page of memory
// as the environment array just as an added measure of protection.
if (((uintptr_t) environ) / page_size == ((uintptr_t) main_argv) / page_size)
- g_main_argv = main_argv;
+ g_main_argv = const_cast<char**>(main_argv);
}
diff --git a/content/common/set_process_title_linux.h b/content/common/set_process_title_linux.h
index a33dfe3..9eafb77 100644
--- a/content/common/set_process_title_linux.h
+++ b/content/common/set_process_title_linux.h
@@ -18,6 +18,6 @@ void setproctitle(const char* fmt, ...);
// Initialize state needed for setproctitle() on Linux. Pass the argv pointer
// from main() to setproctitle_init() before calling setproctitle().
-void setproctitle_init(char** main_argv);
+void setproctitle_init(const char** main_argv);
#endif // CONTENT_COMMON_SET_PROCESS_TITLE_LINUX_H_
diff --git a/content/content.gyp b/content/content.gyp
index 08367e6..fd7776d 100644
--- a/content/content.gyp
+++ b/content/content.gyp
@@ -15,6 +15,7 @@
'content_plugin.gypi',
'content_ppapi_plugin.gypi',
'content_renderer.gypi',
+ 'content_shell.gypi',
'content_tests.gypi',
'content_utility.gypi',
'content_worker.gypi',
diff --git a/content/content_app.gypi b/content/content_app.gypi
index 9e199a5..afb9c2b 100644
--- a/content/content_app.gypi
+++ b/content/content_app.gypi
@@ -21,6 +21,7 @@
'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',
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index fda1259..d0d448a 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -567,6 +567,7 @@
['toolkit_uses_gtk == 1', {
'dependencies': [
'../build/linux/system.gyp:dbus',
+ '../build/linux/system.gyp:dbus-glib',
# For FcLangSetAdd call in render_sandbox_host_linux.cc
'../build/linux/system.gyp:fontconfig',
'../build/linux/system.gyp:gtk',
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
new file mode 100644
index 0000000..a4481cf
--- /dev/null
+++ b/content/content_shell.gypi
@@ -0,0 +1,55 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'content_shell',
+ 'type': 'executable',
+ 'dependencies': [
+ 'content_app',
+ 'content_browser',
+ 'content_common',
+ 'content_gpu',
+ 'content_plugin',
+ 'content_ppapi_plugin',
+ 'content_renderer',
+ 'content_utility',
+ 'content_worker',
+ '../skia/skia.gyp:skia',
+ '../ui/ui.gyp:ui',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ 'shell/shell_browser_main.cc',
+ 'shell/shell_browser_main.h',
+ 'shell/shell_content_browser_client.cc',
+ '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_main.cc',
+ ],
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS
+ },
+ },
+ 'conditions': [
+ ['OS=="win" and win_use_allocator_shim==1', {
+ 'dependencies': [
+ '../base/allocator/allocator.gyp:allocator',
+ ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/content/shell/DEPS b/content/shell/DEPS
new file mode 100644
index 0000000..60dbcf4
--- /dev/null
+++ b/content/shell/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+content",
+]
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc
new file mode 100644
index 0000000..a6a06c7
--- /dev/null
+++ b/content/shell/shell_browser_main.cc
@@ -0,0 +1,6 @@
+// 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_browser_main.h"
+
diff --git a/content/shell/shell_browser_main.h b/content/shell/shell_browser_main.h
new file mode 100644
index 0000000..baa67fd
--- /dev/null
+++ b/content/shell/shell_browser_main.h
@@ -0,0 +1,9 @@
+// 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_BROWSER_MAIN_H_
+#define CONTENT_SHELL_SHELL_BROWSER_MAIN_H_
+#pragma once
+
+#endif // CONTENT_SHELL_SHELL_BROWSER_MAIN_H_
diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc
new file mode 100644
index 0000000..15ce376
--- /dev/null
+++ b/content/shell/shell_content_browser_client.cc
@@ -0,0 +1,284 @@
+// 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_browser_client.h"
+
+#include "base/file_path.h"
+#include "content/browser/webui/empty_web_ui_factory.h"
+#include "googleurl/src/gurl.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/clipboard/clipboard.h"
+#include "webkit/glue/webpreferences.h"
+
+namespace content {
+
+ShellContentBrowserClient::~ShellContentBrowserClient() {
+}
+
+BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts(
+ const MainFunctionParams& parameters) {
+ return NULL;
+}
+
+TabContentsView* ShellContentBrowserClient::CreateTabContentsView(
+ TabContents* tab_contents) {
+ return NULL;
+}
+
+void ShellContentBrowserClient::RenderViewHostCreated(
+ RenderViewHost* render_view_host) {
+}
+
+void ShellContentBrowserClient::BrowserRenderProcessHostCreated(
+ BrowserRenderProcessHost* host) {
+}
+
+void ShellContentBrowserClient::PluginProcessHostCreated(
+ PluginProcessHost* host) {
+}
+
+void ShellContentBrowserClient::WorkerProcessHostCreated(
+ WorkerProcessHost* host) {
+}
+
+WebUIFactory* ShellContentBrowserClient::GetWebUIFactory() {
+ // Return an empty factory so callsites don't have to check for NULL.
+ return EmptyWebUIFactory::Get();
+}
+
+GURL ShellContentBrowserClient::GetEffectiveURL(
+ content::BrowserContext* browser_context, const GURL& url) {
+ return GURL();
+}
+
+bool ShellContentBrowserClient::ShouldUseProcessPerSite(
+ BrowserContext* browser_context, const GURL& effective_url) {
+ return false;
+}
+
+bool ShellContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) {
+ return false;
+}
+
+std::string ShellContentBrowserClient::GetCanonicalEncodingNameByAliasName(
+ const std::string& alias_name) {
+ return std::string();
+}
+
+void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
+ CommandLine* command_line, int child_process_id) {
+}
+
+std::string ShellContentBrowserClient::GetApplicationLocale() {
+ return std::string();
+}
+
+std::string ShellContentBrowserClient::GetAcceptLangs(const TabContents* tab) {
+ return std::string();
+}
+
+SkBitmap* ShellContentBrowserClient::GetDefaultFavicon() {
+ static SkBitmap empty;
+ return &empty;
+}
+
+bool ShellContentBrowserClient::AllowAppCache(
+ const GURL& manifest_url,
+ const GURL& first_party,
+ const content::ResourceContext& context) {
+ return true;
+}
+
+bool ShellContentBrowserClient::AllowGetCookie(
+ const GURL& url,
+ const GURL& first_party,
+ const net::CookieList& cookie_list,
+ const content::ResourceContext& context,
+ int render_process_id,
+ int render_view_id) {
+ return true;
+}
+
+bool ShellContentBrowserClient::AllowSetCookie(
+ const GURL& url,
+ const GURL& first_party,
+ const std::string& cookie_line,
+ const content::ResourceContext& context,
+ int render_process_id,
+ int render_view_id,
+ net::CookieOptions* options) {
+ return true;
+}
+
+bool ShellContentBrowserClient::AllowSaveLocalState(
+ const content::ResourceContext& context) {
+ return true;
+}
+
+QuotaPermissionContext*
+ ShellContentBrowserClient::CreateQuotaPermissionContext() {
+ return NULL;
+}
+
+net::URLRequestContext* ShellContentBrowserClient::OverrideRequestContextForURL(
+ const GURL& url, const content::ResourceContext& context) {
+ return NULL;
+}
+
+void ShellContentBrowserClient::OpenItem(const FilePath& path) {
+}
+
+void ShellContentBrowserClient::ShowItemInFolder(const FilePath& path) {
+}
+
+void ShellContentBrowserClient::AllowCertificateError(
+ SSLCertErrorHandler* handler,
+ bool overridable,
+ Callback2<SSLCertErrorHandler*, bool>::Type* callback) {
+}
+
+void ShellContentBrowserClient::SelectClientCertificate(
+ int render_process_id,
+ int render_view_id,
+ SSLClientAuthHandler* handler) {
+}
+
+void ShellContentBrowserClient::AddNewCertificate(
+ net::URLRequest* request,
+ net::X509Certificate* cert,
+ int render_process_id,
+ int render_view_id) {
+}
+
+void ShellContentBrowserClient::RequestDesktopNotificationPermission(
+ const GURL& source_origin,
+ int callback_context,
+ int render_process_id,
+ int render_view_id) {
+}
+
+WebKit::WebNotificationPresenter::Permission
+ ShellContentBrowserClient::CheckDesktopNotificationPermission(
+ const GURL& source_url,
+ const content::ResourceContext& context) {
+ return WebKit::WebNotificationPresenter::PermissionAllowed;
+}
+
+void ShellContentBrowserClient::ShowDesktopNotification(
+ const DesktopNotificationHostMsg_Show_Params& params,
+ int render_process_id,
+ int render_view_id,
+ bool worker) {
+}
+
+void ShellContentBrowserClient::CancelDesktopNotification(
+ int render_process_id,
+ int render_view_id,
+ int notification_id) {
+}
+
+bool ShellContentBrowserClient::CanCreateWindow(
+ const GURL& source_url,
+ WindowContainerType container_type,
+ const content::ResourceContext& context) {
+ return false;
+}
+
+std::string ShellContentBrowserClient::GetWorkerProcessTitle(
+ const GURL& url, const content::ResourceContext& context) {
+ return std::string();
+}
+
+ResourceDispatcherHost* ShellContentBrowserClient::GetResourceDispatcherHost() {
+ return NULL;
+}
+
+ui::Clipboard* ShellContentBrowserClient::GetClipboard() {
+ static ui::Clipboard clipboard;
+ return &clipboard;
+}
+
+MHTMLGenerationManager* ShellContentBrowserClient::GetMHTMLGenerationManager() {
+ return NULL;
+}
+
+DevToolsManager* ShellContentBrowserClient::GetDevToolsManager() {
+ return NULL;
+}
+
+net::NetLog* ShellContentBrowserClient::GetNetLog() {
+ return NULL;
+}
+
+speech_input::SpeechInputManager*
+ ShellContentBrowserClient::GetSpeechInputManager() {
+ return NULL;
+}
+
+AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() {
+ return NULL;
+}
+
+bool ShellContentBrowserClient::IsFastShutdownPossible() {
+ return true;
+}
+
+WebPreferences ShellContentBrowserClient::GetWebkitPrefs(
+ content::BrowserContext* browser_context,
+ bool is_web_ui) {
+ return WebPreferences();
+}
+
+void ShellContentBrowserClient::UpdateInspectorSetting(
+ RenderViewHost* rvh, const std::string& key, const std::string& value) {
+}
+
+void ShellContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) {
+}
+
+void ShellContentBrowserClient::BrowserURLHandlerCreated(
+ BrowserURLHandler* handler) {
+}
+
+void ShellContentBrowserClient::ClearCache(RenderViewHost* rvh) {
+}
+
+void ShellContentBrowserClient::ClearCookies(RenderViewHost* rvh) {
+}
+
+FilePath ShellContentBrowserClient::GetDefaultDownloadDirectory() {
+ return FilePath();
+}
+
+net::URLRequestContextGetter*
+ShellContentBrowserClient::GetDefaultRequestContextDeprecatedCrBug64339() {
+ return NULL;
+}
+
+net::URLRequestContextGetter*
+ShellContentBrowserClient::GetSystemRequestContext() {
+ return NULL;
+}
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+int ShellContentBrowserClient::GetCrashSignalFD(
+ const std::string& process_type) {
+ return -1;
+}
+#endif
+
+#if defined(OS_WIN)
+const wchar_t* ShellContentBrowserClient::GetResourceDllName() {
+ return NULL;
+}
+#endif
+
+#if defined(USE_NSS)
+crypto::CryptoModuleBlockingPasswordDelegate*
+ ShellContentBrowserClient::GetCryptoPasswordDelegate(const GURL& url) {
+ return NULL;
+}
+#endif
+
+} // namespace content
diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h
new file mode 100644
index 0000000..a611197
--- /dev/null
+++ b/content/shell/shell_content_browser_client.h
@@ -0,0 +1,143 @@
+// 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_BROWSER_CLIENT_H_
+#define CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_
+#pragma once
+
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "content/browser/content_browser_client.h"
+
+namespace content {
+
+class ShellContentBrowserClient : public ContentBrowserClient {
+ public:
+ virtual ~ShellContentBrowserClient();
+
+ virtual BrowserMainParts* CreateBrowserMainParts(
+ const MainFunctionParams& parameters) OVERRIDE;
+ virtual TabContentsView* CreateTabContentsView(
+ TabContents* tab_contents) OVERRIDE;
+ virtual void RenderViewHostCreated(
+ RenderViewHost* render_view_host) OVERRIDE;
+ virtual void BrowserRenderProcessHostCreated(
+ BrowserRenderProcessHost* host) OVERRIDE;
+ virtual void PluginProcessHostCreated(PluginProcessHost* host) OVERRIDE;
+ virtual void WorkerProcessHostCreated(WorkerProcessHost* host) OVERRIDE;
+ virtual WebUIFactory* GetWebUIFactory() OVERRIDE;
+ virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
+ const GURL& url) OVERRIDE;
+ virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context,
+ const GURL& effective_url) OVERRIDE;
+ virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE;
+ virtual std::string GetCanonicalEncodingNameByAliasName(
+ const std::string& alias_name) OVERRIDE;
+ virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
+ int child_process_id) OVERRIDE;
+ virtual std::string GetApplicationLocale() OVERRIDE;
+ virtual std::string GetAcceptLangs(const TabContents* tab) OVERRIDE;
+ virtual SkBitmap* GetDefaultFavicon() OVERRIDE;
+ virtual bool AllowAppCache(const GURL& manifest_url,
+ const GURL& first_party,
+ const content::ResourceContext& context) OVERRIDE;
+ virtual bool AllowGetCookie(const GURL& url,
+ const GURL& first_party,
+ const net::CookieList& cookie_list,
+ const content::ResourceContext& context,
+ int render_process_id,
+ int render_view_id) OVERRIDE;
+ virtual bool AllowSetCookie(const GURL& url,
+ const GURL& first_party,
+ const std::string& cookie_line,
+ const content::ResourceContext& context,
+ int render_process_id,
+ int render_view_id,
+ net::CookieOptions* options) OVERRIDE;
+ virtual bool AllowSaveLocalState(
+ const content::ResourceContext& context) OVERRIDE;
+ virtual net::URLRequestContext* OverrideRequestContextForURL(
+ const GURL& url, const content::ResourceContext& context) OVERRIDE;
+ virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE;
+ virtual void OpenItem(const FilePath& path) OVERRIDE;
+ virtual void ShowItemInFolder(const FilePath& path) OVERRIDE;
+ virtual void AllowCertificateError(
+ SSLCertErrorHandler* handler,
+ bool overridable,
+ Callback2<SSLCertErrorHandler*, bool>::Type* callback) OVERRIDE;
+ virtual void SelectClientCertificate(
+ int render_process_id,
+ int render_view_id,
+ SSLClientAuthHandler* handler) OVERRIDE;
+ virtual void AddNewCertificate(
+ net::URLRequest* request,
+ net::X509Certificate* cert,
+ int render_process_id,
+ int render_view_id) OVERRIDE;
+ virtual void RequestDesktopNotificationPermission(
+ const GURL& source_origin,
+ int callback_context,
+ int render_process_id,
+ int render_view_id) OVERRIDE;
+ virtual WebKit::WebNotificationPresenter::Permission
+ CheckDesktopNotificationPermission(
+ const GURL& source_url,
+ const content::ResourceContext& context) OVERRIDE;
+ virtual void ShowDesktopNotification(
+ const DesktopNotificationHostMsg_Show_Params& params,
+ int render_process_id,
+ int render_view_id,
+ bool worker) OVERRIDE;
+ virtual void CancelDesktopNotification(
+ int render_process_id,
+ int render_view_id,
+ int notification_id) OVERRIDE;
+ virtual bool CanCreateWindow(
+ const GURL& source_url,
+ WindowContainerType container_type,
+ const content::ResourceContext& context) OVERRIDE;
+ virtual std::string GetWorkerProcessTitle(
+ const GURL& url, const content::ResourceContext& context) OVERRIDE;
+ virtual ResourceDispatcherHost* GetResourceDispatcherHost() OVERRIDE;
+ virtual ui::Clipboard* GetClipboard() OVERRIDE;
+ virtual MHTMLGenerationManager* GetMHTMLGenerationManager() OVERRIDE;
+ virtual DevToolsManager* GetDevToolsManager() OVERRIDE;
+ virtual net::NetLog* GetNetLog() OVERRIDE;
+ virtual speech_input::SpeechInputManager* GetSpeechInputManager() OVERRIDE;
+ virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
+ virtual bool IsFastShutdownPossible() OVERRIDE;
+ virtual WebPreferences GetWebkitPrefs(
+ content::BrowserContext* browser_context,
+ bool is_web_ui) OVERRIDE;
+ virtual void UpdateInspectorSetting(RenderViewHost* rvh,
+ const std::string& key,
+ const std::string& value) OVERRIDE;
+ virtual void ClearInspectorSettings(RenderViewHost* rvh) OVERRIDE;
+ virtual void BrowserURLHandlerCreated(BrowserURLHandler* handler) OVERRIDE;
+ virtual void ClearCache(RenderViewHost* rvh) OVERRIDE;
+ virtual void ClearCookies(RenderViewHost* rvh) OVERRIDE;
+ virtual FilePath GetDefaultDownloadDirectory() OVERRIDE;
+ virtual net::URLRequestContextGetter*
+ GetDefaultRequestContextDeprecatedCrBug64339() OVERRIDE;
+ virtual net::URLRequestContextGetter* GetSystemRequestContext() OVERRIDE;
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ virtual int GetCrashSignalFD(const std::string& process_type) OVERRIDE;
+#endif
+
+#if defined(OS_WIN)
+ virtual const wchar_t* GetResourceDllName() OVERRIDE;
+#endif
+
+#if defined(USE_NSS)
+ virtual
+ crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate(
+ const GURL& url) OVERRIDE;
+#endif
+};
+
+} // namespace content
+
+#endif // CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_
diff --git a/content/shell/shell_content_client.cc b/content/shell/shell_content_client.cc
new file mode 100644
index 0000000..12bb53d
--- /dev/null
+++ b/content/shell/shell_content_client.cc
@@ -0,0 +1,51 @@
+// 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_client.h"
+
+#include "base/string_piece.h"
+
+namespace content {
+
+ShellContentClient::~ShellContentClient() {
+}
+
+void ShellContentClient::SetActiveURL(const GURL& url) {
+}
+
+void ShellContentClient::SetGpuInfo(const GPUInfo& gpu_info) {
+}
+
+void ShellContentClient::AddPepperPlugins(
+ std::vector<PepperPluginInfo>* plugins) {
+}
+
+bool ShellContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
+ return false;
+}
+
+bool ShellContentClient::CanHandleWhileSwappedOut(const IPC::Message& msg) {
+ return false;
+}
+
+std::string ShellContentClient::GetUserAgent(bool mimic_windows) const {
+ return std::string();
+}
+
+string16 ShellContentClient::GetLocalizedString(int message_id) const {
+ return string16();
+}
+
+base::StringPiece ShellContentClient::GetDataResource(int resource_id) const {
+ return base::StringPiece();
+}
+
+#if defined(OS_WIN)
+bool ShellContentClient::SandboxPlugin(CommandLine* command_line,
+ sandbox::TargetPolicy* policy) {
+ return false;
+}
+#endif
+
+} // namespace content
diff --git a/content/shell/shell_content_client.h b/content/shell/shell_content_client.h
new file mode 100644
index 0000000..35b2020
--- /dev/null
+++ b/content/shell/shell_content_client.h
@@ -0,0 +1,36 @@
+// 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_CLIENT_H_
+#define CONTENT_SHELL_SHELL_CONTENT_CLIENT_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "content/common/content_client.h"
+
+namespace content {
+
+class ShellContentClient : public ContentClient {
+ public:
+ virtual ~ShellContentClient();
+
+ virtual void SetActiveURL(const GURL& url) OVERRIDE;
+ virtual void SetGpuInfo(const GPUInfo& gpu_info) OVERRIDE;
+ virtual void AddPepperPlugins(
+ std::vector<PepperPluginInfo>* plugins) OVERRIDE;
+ virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;
+ virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
+ virtual std::string GetUserAgent(bool mimic_windows) const OVERRIDE;
+ virtual string16 GetLocalizedString(int message_id) const OVERRIDE;
+ virtual base::StringPiece GetDataResource(int resource_id) const OVERRIDE;
+
+#if defined(OS_WIN)
+ virtual bool SandboxPlugin(CommandLine* command_line,
+ sandbox::TargetPolicy* policy) OVERRIDE;
+#endif
+};
+
+} // namespace content
+
+#endif // CONTENT_SHELL_SHELL_CONTENT_CLIENT_H_
diff --git a/content/shell/shell_content_plugin_client.cc b/content/shell/shell_content_plugin_client.cc
new file mode 100644
index 0000000..81a6bd9
--- /dev/null
+++ b/content/shell/shell_content_plugin_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 "content/shell/shell_content_plugin_client.h"
+
+namespace content {
+
+ShellContentPluginClient::~ShellContentPluginClient() {
+}
+
+void ShellContentPluginClient::PluginProcessStarted(
+ const string16& plugin_name) {
+}
+
+} // namespace content
diff --git a/content/shell/shell_content_plugin_client.h b/content/shell/shell_content_plugin_client.h
new file mode 100644
index 0000000..0fd0bdf
--- /dev/null
+++ b/content/shell/shell_content_plugin_client.h
@@ -0,0 +1,22 @@
+// 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/plugin/content_plugin_client.h"
+
+namespace content {
+
+class ShellContentPluginClient : public ContentPluginClient {
+ public:
+ virtual ~ShellContentPluginClient();
+ virtual void PluginProcessStarted(const string16& plugin_name) OVERRIDE;
+};
+
+} // namespace content
+
+#endif // CONTENT_SHELL_SHELL_CONTENT_PLUGIN_CLIENT_H_
diff --git a/content/shell/shell_content_renderer_client.cc b/content/shell/shell_content_renderer_client.cc
new file mode 100644
index 0000000..72b04b7
--- /dev/null
+++ b/content/shell/shell_content_renderer_client.cc
@@ -0,0 +1,122 @@
+// 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_renderer_client.h"
+
+#include "v8/include/v8.h"
+
+namespace content {
+
+ShellContentRendererClient::~ShellContentRendererClient() {
+}
+
+void ShellContentRendererClient::RenderThreadStarted() {
+}
+
+void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) {
+}
+
+void ShellContentRendererClient::SetNumberOfViews(int number_of_views) {
+}
+
+SkBitmap* ShellContentRendererClient::GetSadPluginBitmap() {
+ return NULL;
+}
+
+std::string ShellContentRendererClient::GetDefaultEncoding() {
+ return std::string();
+}
+
+WebKit::WebPlugin* ShellContentRendererClient::CreatePlugin(
+ RenderView* render_view,
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params) {
+ return NULL;
+}
+
+void ShellContentRendererClient::ShowErrorPage(RenderView* render_view,
+ WebKit::WebFrame* frame,
+ int http_status_code) {
+}
+
+std::string ShellContentRendererClient::GetNavigationErrorHtml(
+ const WebKit::WebURLRequest& failed_request,
+ const WebKit::WebURLError& error) {
+ return std::string();
+}
+
+bool ShellContentRendererClient::RunIdleHandlerWhenWidgetsHidden() {
+ return true;
+}
+
+bool ShellContentRendererClient::AllowPopup(const GURL& creator) {
+ return false;
+}
+
+bool ShellContentRendererClient::ShouldFork(WebKit::WebFrame* frame,
+ const GURL& url,
+ bool is_content_initiated,
+ bool is_initial_navigation,
+ bool* send_referrer) {
+ return false;
+}
+
+bool ShellContentRendererClient::WillSendRequest(WebKit::WebFrame* frame,
+ const GURL& url,
+ GURL* new_url) {
+ return false;
+}
+
+bool ShellContentRendererClient::ShouldPumpEventsDuringCookieMessage() {
+ return false;
+}
+
+void ShellContentRendererClient::DidCreateScriptContext(
+ WebKit::WebFrame* frame) {
+}
+
+void ShellContentRendererClient::DidDestroyScriptContext(
+ WebKit::WebFrame* frame) {
+}
+
+void ShellContentRendererClient::DidCreateIsolatedScriptContext(
+ WebKit::WebFrame* frame, int world_id, v8::Handle<v8::Context> context) {
+}
+
+unsigned long long ShellContentRendererClient::VisitedLinkHash(
+ const char* canonical_url, size_t length) {
+ return 0LL;
+}
+
+bool ShellContentRendererClient::IsLinkVisited(unsigned long long link_hash) {
+ return false;
+}
+
+void ShellContentRendererClient::PrefetchHostName(
+ const char* hostname, size_t length) {
+}
+
+bool ShellContentRendererClient::ShouldOverridePageVisibilityState(
+ const RenderView* render_view,
+ WebKit::WebPageVisibilityState* override_state) const {
+ return false;
+}
+
+bool ShellContentRendererClient::HandleGetCookieRequest(
+ RenderView* sender,
+ const GURL& url,
+ const GURL& first_party_for_cookies,
+ std::string* cookies) {
+ return false;
+}
+
+bool ShellContentRendererClient::HandleSetCookieRequest(
+ RenderView* sender,
+ const GURL& url,
+ const GURL& first_party_for_cookies,
+ const std::string& value) {
+ return false;
+}
+
+} // namespace content
diff --git a/content/shell/shell_content_renderer_client.h b/content/shell/shell_content_renderer_client.h
new file mode 100644
index 0000000..a584521d
--- /dev/null
+++ b/content/shell/shell_content_renderer_client.h
@@ -0,0 +1,67 @@
+// 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_RENDERER_CLIENT_H_
+#define CONTENT_SHELL_SHELL_CONTENT_RENDERER_CLIENT_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "content/renderer/content_renderer_client.h"
+
+namespace content {
+
+class ShellContentRendererClient : public ContentRendererClient {
+ public:
+ virtual ~ShellContentRendererClient();
+ 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 WebKit::WebPlugin* CreatePlugin(
+ RenderView* render_view,
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params) OVERRIDE;
+ virtual void ShowErrorPage(RenderView* render_view,
+ WebKit::WebFrame* frame,
+ int http_status_code) OVERRIDE;
+ virtual std::string GetNavigationErrorHtml(
+ const WebKit::WebURLRequest& failed_request,
+ const WebKit::WebURLError& error) OVERRIDE;
+ virtual bool RunIdleHandlerWhenWidgetsHidden() OVERRIDE;
+ virtual bool AllowPopup(const GURL& creator) OVERRIDE;
+ virtual bool ShouldFork(WebKit::WebFrame* frame,
+ const GURL& url,
+ bool is_content_initiated,
+ 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) OVERRIDE;
+ virtual void DidDestroyScriptContext(WebKit::WebFrame* frame) OVERRIDE;
+ virtual void DidCreateIsolatedScriptContext(
+ WebKit::WebFrame* frame, int world_id,
+ v8::Handle<v8::Context> context) 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;
+};
+
+} // namespace content
+
+#endif // CONTENT_SHELL_SHELL_CONTENT_RENDERER_CLIENT_H_
diff --git a/content/shell/shell_content_utility_client.cc b/content/shell/shell_content_utility_client.cc
new file mode 100644
index 0000000..fb2a285
--- /dev/null
+++ b/content/shell/shell_content_utility_client.cc
@@ -0,0 +1,19 @@
+// 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
new file mode 100644
index 0000000..287a79f
--- /dev/null
+++ b/content/shell/shell_content_utility_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_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_
+#define CONTENT_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "content/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.cc b/content/shell/shell_main.cc
new file mode 100644
index 0000000..c5a9227
--- /dev/null
+++ b/content/shell/shell_main.cc
@@ -0,0 +1,93 @@
+// 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.h"
+
+#include "base/command_line.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/app/content_main_delegate.h"
+#include "content/common/content_switches.h"
+#include "content/shell/shell_content_browser_client.h"
+#include "content/shell/shell_content_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 "sandbox/src/sandbox_types.h"
+
+#if defined(OS_WIN)
+#include "content/app/startup_helper_win.h"
+#endif
+
+namespace {
+
+class ShellMainDelegate : public content::ContentMainDelegate {
+ public:
+ virtual void PreSandboxStartup() OVERRIDE {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ std::string process_type =
+ command_line.GetSwitchValueASCII(switches::kProcessType);
+
+ content::SetContentClient(&content_client_);
+ InitializeShellContentClient(process_type);
+ }
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ virtual void ZygoteForked() OVERRIDE {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ std::string process_type =
+ command_line.GetSwitchValueASCII(switches::kProcessType);
+ InitializeShellContentClient(process_type);
+ }
+#endif
+
+ private:
+ void InitializeShellContentClient(const std::string& process_type) {
+ if (process_type.empty()) {
+ browser_client_.reset(new content::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());
+ }
+ }
+
+ 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_;
+};
+
+} // namespace
+
+#if defined(OS_WIN)
+
+int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
+ sandbox::SandboxInterfaceInfo sandbox_info = {0};
+ content::InitializeSandboxInfo(&sandbox_info);
+ ShellMainDelegate delegate;
+ return content::ContentMain(instance, &sandbox_info, &delegate);
+}
+#endif
+
+#if defined(OS_POSIX)
+
+#if defined(OS_MACOSX)
+__attribute__((visibility("default")))
+int main(int argc, const char* argv[]) {
+#else
+int main(int argc, const char** argv) {
+#endif // OS_MACOSX
+
+ ShellMainDelegate delegate;
+ return content::ContentMain(argc, argv, &delegate);
+}
+
+#endif // OS_POSIX