| 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/shell/shell_browser_main.h" | 11 #include "content/shell/shell_browser_main.h" |
| 12 #include "content/shell/shell_content_browser_client.h" | 12 #include "content/shell/shell_content_browser_client.h" |
| 13 #include "content/shell/shell_content_plugin_client.h" | 13 #include "content/shell/shell_content_plugin_client.h" |
| 14 #include "content/shell/shell_content_renderer_client.h" | 14 #include "content/shell/shell_content_renderer_client.h" |
| 15 #include "content/shell/shell_content_utility_client.h" | 15 #include "content/shell/shell_content_utility_client.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/base/ui_base_paths.h" | 17 #include "ui/base/ui_base_paths.h" |
| 18 #include "webkit/glue/user_agent.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 |
| 33 return false; | 34 return false; |
| 34 } | 35 } |
| 35 | 36 |
| 36 void ShellMainDelegate::PreSandboxStartup() { | 37 void ShellMainDelegate::PreSandboxStartup() { |
| 37 #if defined(OS_MACOSX) | 38 #if defined(OS_MACOSX) |
| 38 OverrideChildProcessPath(); | 39 OverrideChildProcessPath(); |
| 39 #endif // OS_MACOSX | 40 #endif // OS_MACOSX |
| 40 | 41 |
| 41 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 42 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 42 std::string process_type = | 43 std::string process_type = |
| 43 command_line.GetSwitchValueASCII(switches::kProcessType); | 44 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 44 | 45 |
| 45 content::SetContentClient(&content_client_); | 46 // The "19" is so that sites that sniff for version think that this is |
| 47 // something reasonably current; the "77.34.5" is a hint that this isn't a |
| 48 // standard Chrome. |
| 49 std::string user_agent = |
| 50 webkit_glue::BuildUserAgentFromProduct("Chrome/19.77.34.5"); |
| 51 |
| 52 content::Initialize(&content_client_, user_agent); |
| 46 InitializeShellContentClient(process_type); | 53 InitializeShellContentClient(process_type); |
| 47 | 54 |
| 48 InitializeResourceBundle(); | 55 InitializeResourceBundle(); |
| 49 } | 56 } |
| 50 | 57 |
| 51 void ShellMainDelegate::SandboxInitialized(const std::string& process_type) { | 58 void ShellMainDelegate::SandboxInitialized(const std::string& process_type) { |
| 52 } | 59 } |
| 53 | 60 |
| 54 int ShellMainDelegate::RunProcess( | 61 int ShellMainDelegate::RunProcess( |
| 55 const std::string& process_type, | 62 const std::string& process_type, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 FilePath pak_file; | 120 FilePath pak_file; |
| 114 #if defined(OS_MACOSX) | 121 #if defined(OS_MACOSX) |
| 115 pak_file = GetResourcesPakFilePath(); | 122 pak_file = GetResourcesPakFilePath(); |
| 116 #else | 123 #else |
| 117 FilePath pak_dir; | 124 FilePath pak_dir; |
| 118 PathService::Get(base::DIR_MODULE, &pak_dir); | 125 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 119 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); | 126 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); |
| 120 #endif | 127 #endif |
| 121 ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file); | 128 ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file); |
| 122 } | 129 } |
| OLD | NEW |