OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/shell_main_delegate.h" | 5 #include "content/shell/shell_main_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
9 #include "content/shell/shell_content_browser_client.h" | 9 #include "content/shell/shell_content_browser_client.h" |
10 #include "content/shell/shell_content_plugin_client.h" | 10 #include "content/shell/shell_content_plugin_client.h" |
11 #include "content/shell/shell_content_renderer_client.h" | 11 #include "content/shell/shell_content_renderer_client.h" |
12 #include "content/shell/shell_content_utility_client.h" | 12 #include "content/shell/shell_content_utility_client.h" |
13 | 13 |
14 ShellMainDelegate::ShellMainDelegate() { | 14 ShellMainDelegate::ShellMainDelegate() { |
15 } | 15 } |
16 | 16 |
17 ShellMainDelegate::~ShellMainDelegate() { | 17 ShellMainDelegate::~ShellMainDelegate() { |
18 } | 18 } |
19 | 19 |
| 20 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
| 21 return false; |
| 22 } |
| 23 |
20 void ShellMainDelegate::PreSandboxStartup() { | 24 void ShellMainDelegate::PreSandboxStartup() { |
21 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 25 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
22 std::string process_type = | 26 std::string process_type = |
23 command_line.GetSwitchValueASCII(switches::kProcessType); | 27 command_line.GetSwitchValueASCII(switches::kProcessType); |
24 | 28 |
25 content::SetContentClient(&content_client_); | 29 content::SetContentClient(&content_client_); |
26 InitializeShellContentClient(process_type); | 30 InitializeShellContentClient(process_type); |
27 } | 31 } |
28 | 32 |
29 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 33 void ShellMainDelegate::SandboxInitialized(const std::string& process_type) { |
| 34 } |
| 35 |
| 36 int ShellMainDelegate::RunProcess( |
| 37 const std::string& process_type, |
| 38 const MainFunctionParams& main_function_params) { |
| 39 NOTREACHED(); |
| 40 return -1; |
| 41 } |
| 42 |
| 43 void ShellMainDelegate::ProcessExiting(const std::string& process_type) { |
| 44 } |
| 45 |
| 46 #if defined(OS_MACOSX) |
| 47 bool ShellMainDelegate::ProcessRegistersWithSystemProcess( |
| 48 const std::string& process_type) { |
| 49 return false; |
| 50 } |
| 51 |
| 52 bool ShellMainDelegate::ShouldSendMachPort(const std::string& process_type) { |
| 53 return false; |
| 54 } |
| 55 |
| 56 bool ShellMainDelegate::DelaySandboxInitialization( |
| 57 const std::string& process_type) { |
| 58 return false; |
| 59 } |
| 60 |
| 61 #elif defined(OS_POSIX) |
| 62 ZygoteForkDelegate* ShellMainDelegate::ZygoteStarting() { |
| 63 return NULL; |
| 64 } |
| 65 |
30 void ShellMainDelegate::ZygoteForked() { | 66 void ShellMainDelegate::ZygoteForked() { |
31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 67 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
32 std::string process_type = | 68 std::string process_type = |
33 command_line.GetSwitchValueASCII(switches::kProcessType); | 69 command_line.GetSwitchValueASCII(switches::kProcessType); |
34 InitializeShellContentClient(process_type); | 70 InitializeShellContentClient(process_type); |
35 } | 71 } |
36 #endif | 72 #endif // OS_MACOSX |
37 | 73 |
38 void ShellMainDelegate::InitializeShellContentClient( | 74 void ShellMainDelegate::InitializeShellContentClient( |
39 const std::string& process_type) { | 75 const std::string& process_type) { |
40 if (process_type.empty()) { | 76 if (process_type.empty()) { |
41 browser_client_.reset(new content::ShellContentBrowserClient); | 77 browser_client_.reset(new content::ShellContentBrowserClient); |
42 content::GetContentClient()->set_browser(browser_client_.get()); | 78 content::GetContentClient()->set_browser(browser_client_.get()); |
43 } else if (process_type == switches::kRendererProcess) { | 79 } else if (process_type == switches::kRendererProcess) { |
44 renderer_client_.reset(new content::ShellContentRendererClient); | 80 renderer_client_.reset(new content::ShellContentRendererClient); |
45 content::GetContentClient()->set_renderer(renderer_client_.get()); | 81 content::GetContentClient()->set_renderer(renderer_client_.get()); |
46 } else if (process_type == switches::kPluginProcess) { | 82 } else if (process_type == switches::kPluginProcess) { |
47 plugin_client_.reset(new content::ShellContentPluginClient); | 83 plugin_client_.reset(new content::ShellContentPluginClient); |
48 content::GetContentClient()->set_plugin(plugin_client_.get()); | 84 content::GetContentClient()->set_plugin(plugin_client_.get()); |
49 } else if (process_type == switches::kUtilityProcess) { | 85 } else if (process_type == switches::kUtilityProcess) { |
50 utility_client_.reset(new content::ShellContentUtilityClient); | 86 utility_client_.reset(new content::ShellContentUtilityClient); |
51 content::GetContentClient()->set_utility(utility_client_.get()); | 87 content::GetContentClient()->set_utility(utility_client_.get()); |
52 } | 88 } |
53 } | 89 } |
OLD | NEW |