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(OS_MACOSX) | |
| 26 #include "extensions/shell/app/paths_mac.h" | |
| 27 #endif | |
| 28 | |
| 25 #if !defined(DISABLE_NACL) | 29 #if !defined(DISABLE_NACL) |
| 26 #include "components/nacl/common/nacl_switches.h" | 30 #include "components/nacl/common/nacl_switches.h" |
| 27 #if defined(OS_LINUX) | 31 #if defined(OS_LINUX) |
| 28 #include "components/nacl/common/nacl_paths.h" | 32 #include "components/nacl/common/nacl_paths.h" |
| 29 #endif // OS_LINUX | 33 #endif // OS_LINUX |
| 30 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 34 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 31 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" | 35 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" |
| 32 #endif // OS_POSIX && !OS_MACOSX && !OS_ANDROID | 36 #endif // OS_POSIX && !OS_MACOSX && !OS_ANDROID |
| 33 #endif // !DISABLE_NACL | 37 #endif // !DISABLE_NACL |
| 34 | 38 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 54 } | 58 } |
| 55 | 59 |
| 56 ShellMainDelegate::~ShellMainDelegate() { | 60 ShellMainDelegate::~ShellMainDelegate() { |
| 57 } | 61 } |
| 58 | 62 |
| 59 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 63 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
| 60 InitLogging(); | 64 InitLogging(); |
| 61 content_client_.reset(CreateContentClient()); | 65 content_client_.reset(CreateContentClient()); |
| 62 SetContentClient(content_client_.get()); | 66 SetContentClient(content_client_.get()); |
| 63 | 67 |
| 68 #if defined(OS_MACOSX) | |
| 69 OverrideChildProcessFilePath(); | |
| 70 // This must happen before InitializeResourceBundle. | |
| 71 OverrideFrameworkBundlePath(); | |
| 72 #endif | |
| 73 | |
| 64 #if defined(OS_CHROMEOS) | 74 #if defined(OS_CHROMEOS) |
| 65 chromeos::RegisterPathProvider(); | 75 chromeos::RegisterPathProvider(); |
| 66 #endif | 76 #endif |
| 67 #if !defined(DISABLE_NACL) && defined(OS_LINUX) | 77 #if !defined(DISABLE_NACL) && defined(OS_LINUX) |
| 68 nacl::RegisterPathProvider(); | 78 nacl::RegisterPathProvider(); |
| 69 #endif | 79 #endif |
| 70 extensions::RegisterPathProvider(); | 80 extensions::RegisterPathProvider(); |
| 71 return false; | 81 return false; |
| 72 } | 82 } |
| 73 | 83 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 return new ShellContentRendererClient(); | 128 return new ShellContentRendererClient(); |
| 119 } | 129 } |
| 120 | 130 |
| 121 content::ContentUtilityClient* | 131 content::ContentUtilityClient* |
| 122 ShellMainDelegate::CreateShellContentUtilityClient() { | 132 ShellMainDelegate::CreateShellContentUtilityClient() { |
| 123 return new ShellContentUtilityClient(); | 133 return new ShellContentUtilityClient(); |
| 124 } | 134 } |
| 125 | 135 |
| 126 void ShellMainDelegate::InitializeResourceBundle() { | 136 void ShellMainDelegate::InitializeResourceBundle() { |
| 127 base::FilePath extensions_shell_and_test_pak_path; | 137 base::FilePath extensions_shell_and_test_pak_path; |
| 138 #if defined(OS_MACOSX) | |
| 139 extensions_shell_and_test_pak_path = GetResourcesPakFilePath(); | |
|
James Cook
2014/12/10 21:05:00
It feels a little weird that sometimes you call a
Yoyo Zhou
2014/12/11 02:40:50
I moved the GetResourcesPakFilePath implementation
| |
| 140 #else | |
| 128 PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path); | 141 PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path); |
| 142 extensions_shell_and_test_pak_path = | |
| 143 extensions_shell_and_test_pak_path.AppendASCII( | |
| 144 "extensions_shell_and_test.pak"); | |
| 145 #endif // OS_MACOSX | |
| 129 ui::ResourceBundle::InitSharedInstanceWithPakPath( | 146 ui::ResourceBundle::InitSharedInstanceWithPakPath( |
| 130 extensions_shell_and_test_pak_path.AppendASCII( | 147 extensions_shell_and_test_pak_path); |
| 131 "extensions_shell_and_test.pak")); | |
| 132 } | 148 } |
| 133 | 149 |
| 134 // static | 150 // static |
| 135 bool ShellMainDelegate::ProcessNeedsResourceBundle( | 151 bool ShellMainDelegate::ProcessNeedsResourceBundle( |
| 136 const std::string& process_type) { | 152 const std::string& process_type) { |
| 137 // The browser process has no process type flag, but needs resources. | 153 // The browser process has no process type flag, but needs resources. |
| 138 // On Linux the zygote process opens the resources for the renderers. | 154 // On Linux the zygote process opens the resources for the renderers. |
| 139 return process_type.empty() || | 155 return process_type.empty() || |
| 140 process_type == switches::kZygoteProcess || | 156 process_type == switches::kZygoteProcess || |
| 141 process_type == switches::kRendererProcess || | 157 process_type == switches::kRendererProcess || |
| 142 #if !defined(DISABLE_NACL) | 158 #if !defined(DISABLE_NACL) |
| 143 process_type == switches::kNaClLoaderProcess || | 159 process_type == switches::kNaClLoaderProcess || |
| 144 #endif | 160 #endif |
| 145 #if defined(OS_MACOSX) | 161 #if defined(OS_MACOSX) |
| 146 process_type == switches::kGpuProcess || | 162 process_type == switches::kGpuProcess || |
| 147 #endif | 163 #endif |
| 148 process_type == switches::kUtilityProcess; | 164 process_type == switches::kUtilityProcess; |
| 149 } | 165 } |
| 150 | 166 |
| 151 } // namespace extensions | 167 } // namespace extensions |
| OLD | NEW |