Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/app/shell_main_delegate.h" | 5 #include "extensions/shell/app/shell_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/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" |
| 11 #include "content/public/browser/browser_main_runner.h" | 11 #include "content/public/browser/browser_main_runner.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "extensions/common/extension_paths.h" | 13 #include "extensions/common/extension_paths.h" |
| 14 #include "extensions/shell/browser/default_shell_browser_main_delegate.h" | 14 #include "extensions/shell/browser/default_shell_browser_main_delegate.h" |
| 15 #include "extensions/shell/browser/shell_content_browser_client.h" | 15 #include "extensions/shell/browser/shell_content_browser_client.h" |
| 16 #include "extensions/shell/common/shell_content_client.h" | 16 #include "extensions/shell/common/shell_content_client.h" |
| 17 #include "extensions/shell/renderer/shell_content_renderer_client.h" | 17 #include "extensions/shell/renderer/shell_content_renderer_client.h" |
| 18 #include "extensions/shell/utility/shell_content_utility_client.h" | 18 #include "extensions/shell/utility/shell_content_utility_client.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 | 20 |
| 21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
| 22 #include "chromeos/chromeos_paths.h" | 22 #include "chromeos/chromeos_paths.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if !defined(DISABLE_NACL) | 25 #if !defined(DISABLE_NACL) && defined(OS_POSIX) && !defined(OS_MACOSX) && \ |
|
James Cook
2014/11/11 18:23:52
Are you sure this is right? kNaClLoaderProcess are
Yoyo Zhou
2014/11/15 01:05:44
These are the requirements for ZygoteStarting, but
| |
| 26 !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 26 #include "components/nacl/common/nacl_switches.h" | 27 #include "components/nacl/common/nacl_switches.h" |
| 27 #if defined(OS_LINUX) | 28 #if defined(OS_LINUX) |
| 28 #include "components/nacl/common/nacl_paths.h" | 29 #include "components/nacl/common/nacl_paths.h" |
| 29 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" | 30 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" |
| 30 #endif // OS_LINUX | 31 #endif // OS_LINUX |
| 31 #endif // !DISABLE_NACL | 32 #endif // !DISABLE_NACL && OS_POSIX && !OS_MACOSX && !OS_ANDROID && !OS_IOS |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 void InitLogging() { | 36 void InitLogging() { |
| 36 base::FilePath log_filename; | 37 base::FilePath log_filename; |
| 37 PathService::Get(base::DIR_EXE, &log_filename); | 38 PathService::Get(base::DIR_EXE, &log_filename); |
| 38 log_filename = log_filename.AppendASCII("app_shell.log"); | 39 log_filename = log_filename.AppendASCII("app_shell.log"); |
| 39 logging::LoggingSettings settings; | 40 logging::LoggingSettings settings; |
| 40 settings.logging_dest = logging::LOG_TO_ALL; | 41 settings.logging_dest = logging::LOG_TO_ALL; |
| 41 settings.log_file = log_filename.value().c_str(); | 42 settings.log_file = log_filename.value().c_str(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 ShellMainDelegate::CreateContentRendererClient() { | 87 ShellMainDelegate::CreateContentRendererClient() { |
| 87 renderer_client_.reset(CreateShellContentRendererClient()); | 88 renderer_client_.reset(CreateShellContentRendererClient()); |
| 88 return renderer_client_.get(); | 89 return renderer_client_.get(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 content::ContentUtilityClient* ShellMainDelegate::CreateContentUtilityClient() { | 92 content::ContentUtilityClient* ShellMainDelegate::CreateContentUtilityClient() { |
| 92 utility_client_.reset(CreateShellContentUtilityClient()); | 93 utility_client_.reset(CreateShellContentUtilityClient()); |
| 93 return utility_client_.get(); | 94 return utility_client_.get(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 97 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ |
| 98 !defined(OS_IOS) | |
| 97 void ShellMainDelegate::ZygoteStarting( | 99 void ShellMainDelegate::ZygoteStarting( |
| 98 ScopedVector<content::ZygoteForkDelegate>* delegates) { | 100 ScopedVector<content::ZygoteForkDelegate>* delegates) { |
| 99 #if !defined(DISABLE_NACL) | 101 #if !defined(DISABLE_NACL) |
| 100 nacl::AddNaClZygoteForkDelegates(delegates); | 102 nacl::AddNaClZygoteForkDelegates(delegates); |
| 101 #endif // DISABLE_NACL | 103 #endif // DISABLE_NACL |
| 102 } | 104 } |
| 103 #endif // OS_POSIX && !OS_MACOSX && !OS_ANDROID | 105 #endif // OS_POSIX && !OS_MACOSX && !OS_ANDROID && !OS_IOS |
| 104 | 106 |
| 105 content::ContentClient* ShellMainDelegate::CreateContentClient() { | 107 content::ContentClient* ShellMainDelegate::CreateContentClient() { |
| 106 return new ShellContentClient(); | 108 return new ShellContentClient(); |
| 107 } | 109 } |
| 108 | 110 |
| 109 content::ContentBrowserClient* | 111 content::ContentBrowserClient* |
| 110 ShellMainDelegate::CreateShellContentBrowserClient() { | 112 ShellMainDelegate::CreateShellContentBrowserClient() { |
| 111 return new ShellContentBrowserClient(new DefaultShellBrowserMainDelegate()); | 113 return new ShellContentBrowserClient(new DefaultShellBrowserMainDelegate()); |
| 112 } | 114 } |
| 113 | 115 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 133 bool ShellMainDelegate::ProcessNeedsResourceBundle( | 135 bool ShellMainDelegate::ProcessNeedsResourceBundle( |
| 134 const std::string& process_type) { | 136 const std::string& process_type) { |
| 135 // The browser process has no process type flag, but needs resources. | 137 // The browser process has no process type flag, but needs resources. |
| 136 // On Linux the zygote process opens the resources for the renderers. | 138 // On Linux the zygote process opens the resources for the renderers. |
| 137 return process_type.empty() || | 139 return process_type.empty() || |
| 138 process_type == switches::kZygoteProcess || | 140 process_type == switches::kZygoteProcess || |
| 139 process_type == switches::kRendererProcess || | 141 process_type == switches::kRendererProcess || |
| 140 #if !defined(DISABLE_NACL) | 142 #if !defined(DISABLE_NACL) |
| 141 process_type == switches::kNaClLoaderProcess || | 143 process_type == switches::kNaClLoaderProcess || |
| 142 #endif | 144 #endif |
| 143 process_type == switches::kUtilityProcess; | 145 process_type == switches::kUtilityProcess || |
| 146 process_type == switches::kGpuProcess; | |
|
James Cook
2014/11/11 18:23:52
In Chrome this is only needed on Mac OS -- is this
Yoyo Zhou
2014/11/15 01:05:44
I think that's right.
| |
| 144 } | 147 } |
| 145 | 148 |
| 146 } // namespace extensions | 149 } // namespace extensions |
| OLD | NEW |