| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 log_filename.value().c_str(), | 37 log_filename.value().c_str(), |
| 38 logging::LOG_ONLY_TO_FILE, | 38 logging::LOG_ONLY_TO_FILE, |
| 39 logging::LOCK_LOG_FILE, | 39 logging::LOCK_LOG_FILE, |
| 40 logging::DELETE_OLD_LOG_FILE, | 40 logging::DELETE_OLD_LOG_FILE, |
| 41 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 41 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
| 42 logging::SetLogItems(true, true, true, true); | 42 logging::SetLogItems(true, true, true, true); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 namespace content { |
| 48 |
| 47 ShellMainDelegate::ShellMainDelegate() { | 49 ShellMainDelegate::ShellMainDelegate() { |
| 48 } | 50 } |
| 49 | 51 |
| 50 ShellMainDelegate::~ShellMainDelegate() { | 52 ShellMainDelegate::~ShellMainDelegate() { |
| 51 #if defined(OS_ANDROID) | 53 #if defined(OS_ANDROID) |
| 52 NOTREACHED(); | 54 NOTREACHED(); |
| 53 #endif | 55 #endif |
| 54 } | 56 } |
| 55 | 57 |
| 56 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 58 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
| 57 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 59 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| 58 InitLogging(); | 60 InitLogging(); |
| 59 CommandLine::ForCurrentProcess()->AppendSwitch( | 61 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 60 switches::kAllowFileAccessFromFiles); | 62 switches::kAllowFileAccessFromFiles); |
| 61 } | 63 } |
| 62 #if defined(OS_MACOSX) | 64 #if defined(OS_MACOSX) |
| 63 OverrideFrameworkBundlePath(); | 65 OverrideFrameworkBundlePath(); |
| 64 #endif | 66 #endif |
| 65 content::SetContentClient(&content_client_); | 67 SetContentClient(&content_client_); |
| 66 return false; | 68 return false; |
| 67 } | 69 } |
| 68 | 70 |
| 69 void ShellMainDelegate::PreSandboxStartup() { | 71 void ShellMainDelegate::PreSandboxStartup() { |
| 70 #if defined(OS_MACOSX) | 72 #if defined(OS_MACOSX) |
| 71 OverrideChildProcessPath(); | 73 OverrideChildProcessPath(); |
| 72 #endif // OS_MACOSX | 74 #endif // OS_MACOSX |
| 73 InitializeResourceBundle(); | 75 InitializeResourceBundle(); |
| 74 } | 76 } |
| 75 | 77 |
| 76 int ShellMainDelegate::RunProcess( | 78 int ShellMainDelegate::RunProcess( |
| 77 const std::string& process_type, | 79 const std::string& process_type, |
| 78 const content::MainFunctionParams& main_function_params) { | 80 const MainFunctionParams& main_function_params) { |
| 79 if (!process_type.empty()) | 81 if (!process_type.empty()) |
| 80 return -1; | 82 return -1; |
| 81 | 83 |
| 82 #if !defined(OS_ANDROID) | 84 #if !defined(OS_ANDROID) |
| 83 return ShellBrowserMain(main_function_params); | 85 return ShellBrowserMain(main_function_params); |
| 84 #else | 86 #else |
| 85 // If no process type is specified, we are creating the main browser process. | 87 // If no process type is specified, we are creating the main browser process. |
| 86 browser_runner_.reset(content::BrowserMainRunner::Create()); | 88 browser_runner_.reset(BrowserMainRunner::Create()); |
| 87 int exit_code = browser_runner_->Initialize(main_function_params); | 89 int exit_code = browser_runner_->Initialize(main_function_params); |
| 88 DCHECK(exit_code < 0) | 90 DCHECK(exit_code < 0) |
| 89 << "BrowserRunner::Initialize failed in ShellMainDelegate"; | 91 << "BrowserRunner::Initialize failed in ShellMainDelegate"; |
| 90 | 92 |
| 91 return exit_code; | 93 return exit_code; |
| 92 #endif | 94 #endif |
| 93 } | 95 } |
| 94 | 96 |
| 95 void ShellMainDelegate::InitializeResourceBundle() { | 97 void ShellMainDelegate::InitializeResourceBundle() { |
| 96 #if defined(OS_ANDROID) | 98 #if defined(OS_ANDROID) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 119 pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); | 121 pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); |
| 120 #else | 122 #else |
| 121 PathService::Get(base::DIR_MODULE, &pak_dir); | 123 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 122 #endif | 124 #endif |
| 123 | 125 |
| 124 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); | 126 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); |
| 125 #endif | 127 #endif |
| 126 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); | 128 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); |
| 127 } | 129 } |
| 128 | 130 |
| 129 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 131 ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
| 130 browser_client_.reset(new content::ShellContentBrowserClient); | 132 browser_client_.reset(new ShellContentBrowserClient); |
| 131 return browser_client_.get(); | 133 return browser_client_.get(); |
| 132 } | 134 } |
| 133 | 135 |
| 134 content::ContentRendererClient* | 136 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { |
| 135 ShellMainDelegate::CreateContentRendererClient() { | 137 renderer_client_.reset(new ShellContentRendererClient); |
| 136 renderer_client_.reset(new content::ShellContentRendererClient); | |
| 137 return renderer_client_.get(); | 138 return renderer_client_.get(); |
| 138 } | 139 } |
| 140 |
| 141 } // namespace content |
| OLD | NEW |