OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 11 #include "content/public/common/url_constants.h" |
11 #include "content/shell/shell_browser_main.h" | 12 #include "content/shell/shell_browser_main.h" |
12 #include "content/shell/shell_content_browser_client.h" | 13 #include "content/shell/shell_content_browser_client.h" |
13 #include "content/shell/shell_content_plugin_client.h" | 14 #include "content/shell/shell_content_plugin_client.h" |
14 #include "content/shell/shell_content_renderer_client.h" | 15 #include "content/shell/shell_content_renderer_client.h" |
15 #include "content/shell/shell_content_utility_client.h" | 16 #include "content/shell/shell_content_utility_client.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/base/ui_base_paths.h" | 18 #include "ui/base/ui_base_paths.h" |
18 | 19 |
19 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
20 #include "content/shell/paths_mac.h" | 21 #include "content/shell/paths_mac.h" |
21 #endif // OS_MACOSX | 22 #endif // OS_MACOSX |
22 | 23 |
23 ShellMainDelegate::ShellMainDelegate() { | 24 ShellMainDelegate::ShellMainDelegate() { |
24 } | 25 } |
25 | 26 |
26 ShellMainDelegate::~ShellMainDelegate() { | 27 ShellMainDelegate::~ShellMainDelegate() { |
27 } | 28 } |
28 | 29 |
29 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 30 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
30 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
31 OverrideFrameworkBundlePath(); | 32 OverrideFrameworkBundlePath(); |
32 #endif | 33 #endif |
| 34 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 35 std::string process_type = |
| 36 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 37 content::SetContentClient(&content_client_); |
| 38 InitializeShellContentClient(process_type); |
| 39 |
33 return false; | 40 return false; |
34 } | 41 } |
35 | 42 |
36 void ShellMainDelegate::PreSandboxStartup() { | 43 void ShellMainDelegate::PreSandboxStartup() { |
37 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
38 OverrideChildProcessPath(); | 45 OverrideChildProcessPath(); |
39 #endif // OS_MACOSX | 46 #endif // OS_MACOSX |
40 | |
41 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
42 std::string process_type = | |
43 command_line.GetSwitchValueASCII(switches::kProcessType); | |
44 | |
45 content::SetContentClient(&content_client_); | |
46 InitializeShellContentClient(process_type); | |
47 | |
48 InitializeResourceBundle(); | 47 InitializeResourceBundle(); |
49 } | 48 } |
50 | 49 |
51 void ShellMainDelegate::SandboxInitialized(const std::string& process_type) { | 50 void ShellMainDelegate::SandboxInitialized(const std::string& process_type) { |
52 } | 51 } |
53 | 52 |
54 int ShellMainDelegate::RunProcess( | 53 int ShellMainDelegate::RunProcess( |
55 const std::string& process_type, | 54 const std::string& process_type, |
56 const content::MainFunctionParams& main_function_params) { | 55 const content::MainFunctionParams& main_function_params) { |
57 if (process_type != "") | 56 if (process_type != "") |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 FilePath pak_file; | 115 FilePath pak_file; |
117 #if defined(OS_MACOSX) | 116 #if defined(OS_MACOSX) |
118 pak_file = GetResourcesPakFilePath(); | 117 pak_file = GetResourcesPakFilePath(); |
119 #else | 118 #else |
120 FilePath pak_dir; | 119 FilePath pak_dir; |
121 PathService::Get(base::DIR_MODULE, &pak_dir); | 120 PathService::Get(base::DIR_MODULE, &pak_dir); |
122 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); | 121 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); |
123 #endif | 122 #endif |
124 ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file); | 123 ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file); |
125 } | 124 } |
OLD | NEW |