Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: extensions/shell/app/shell_main_delegate.cc

Issue 745093002: AppShell support for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittests too Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(OS_MACOSX)
26 #include "extensions/shell/app/paths_mac.h"
27 #endif
28
29 #if !defined(DISABLE_NACL) && defined(OS_POSIX) && !defined(OS_MACOSX) && \
30 !defined(OS_ANDROID)
26 #include "components/nacl/common/nacl_switches.h" 31 #include "components/nacl/common/nacl_switches.h"
27 #if defined(OS_LINUX) 32 #if defined(OS_LINUX)
28 #include "components/nacl/common/nacl_paths.h" 33 #include "components/nacl/common/nacl_paths.h"
29 #endif // OS_LINUX 34 #endif // OS_LINUX
30 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 35 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
31 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" 36 #include "components/nacl/zygote/nacl_fork_delegate_linux.h"
32 #endif // OS_POSIX && !OS_MACOSX && !OS_ANDROID 37 #endif // OS_POSIX && !OS_MACOSX && !OS_ANDROID
33 #endif // !DISABLE_NACL 38 #endif // !DISABLE_NACL
34 39
35 namespace { 40 namespace {
(...skipping 18 matching lines...) Expand all
54 } 59 }
55 60
56 ShellMainDelegate::~ShellMainDelegate() { 61 ShellMainDelegate::~ShellMainDelegate() {
57 } 62 }
58 63
59 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { 64 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
60 InitLogging(); 65 InitLogging();
61 content_client_.reset(CreateContentClient()); 66 content_client_.reset(CreateContentClient());
62 SetContentClient(content_client_.get()); 67 SetContentClient(content_client_.get());
63 68
69 #if defined(OS_MACOSX)
70 OverrideChildProcessFilePath();
71 // This must happen before InitializeResourceBundle.
72 OverrideFrameworkBundlePath();
73 #endif
74
64 #if defined(OS_CHROMEOS) 75 #if defined(OS_CHROMEOS)
65 chromeos::RegisterPathProvider(); 76 chromeos::RegisterPathProvider();
66 #endif 77 #endif
67 #if !defined(DISABLE_NACL) && defined(OS_LINUX) 78 #if !defined(DISABLE_NACL) && defined(OS_LINUX)
68 nacl::RegisterPathProvider(); 79 nacl::RegisterPathProvider();
69 #endif 80 #endif
70 extensions::RegisterPathProvider(); 81 extensions::RegisterPathProvider();
71 return false; 82 return false;
72 } 83 }
73 84
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return new ShellContentRendererClient(); 129 return new ShellContentRendererClient();
119 } 130 }
120 131
121 content::ContentUtilityClient* 132 content::ContentUtilityClient*
122 ShellMainDelegate::CreateShellContentUtilityClient() { 133 ShellMainDelegate::CreateShellContentUtilityClient() {
123 return new ShellContentUtilityClient(); 134 return new ShellContentUtilityClient();
124 } 135 }
125 136
126 void ShellMainDelegate::InitializeResourceBundle() { 137 void ShellMainDelegate::InitializeResourceBundle() {
127 base::FilePath extensions_shell_and_test_pak_path; 138 base::FilePath extensions_shell_and_test_pak_path;
139 #if defined(OS_MACOSX)
140 extensions_shell_and_test_pak_path = GetResourcesPakFilePath();
141 #else
128 PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path); 142 PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path);
143 extensions_shell_and_test_pak_path =
144 extensions_shell_and_test_pak_path.AppendASCII(
145 "extensions_shell_and_test.pak");
146 #endif // OS_MACOSX
129 ui::ResourceBundle::InitSharedInstanceWithPakPath( 147 ui::ResourceBundle::InitSharedInstanceWithPakPath(
130 extensions_shell_and_test_pak_path.AppendASCII( 148 extensions_shell_and_test_pak_path);
131 "extensions_shell_and_test.pak"));
132 } 149 }
133 150
134 // static 151 // static
135 bool ShellMainDelegate::ProcessNeedsResourceBundle( 152 bool ShellMainDelegate::ProcessNeedsResourceBundle(
136 const std::string& process_type) { 153 const std::string& process_type) {
137 // The browser process has no process type flag, but needs resources. 154 // The browser process has no process type flag, but needs resources.
138 // On Linux the zygote process opens the resources for the renderers. 155 // On Linux the zygote process opens the resources for the renderers.
139 return process_type.empty() || 156 return process_type.empty() ||
140 process_type == switches::kZygoteProcess || 157 process_type == switches::kZygoteProcess ||
141 process_type == switches::kRendererProcess || 158 process_type == switches::kRendererProcess ||
142 #if !defined(DISABLE_NACL) 159 #if !defined(DISABLE_NACL)
143 process_type == switches::kNaClLoaderProcess || 160 process_type == switches::kNaClLoaderProcess ||
144 #endif 161 #endif
145 #if defined(OS_MACOSX) 162 #if defined(OS_MACOSX)
146 process_type == switches::kGpuProcess || 163 process_type == switches::kGpuProcess ||
147 #endif 164 #endif
148 process_type == switches::kUtilityProcess; 165 process_type == switches::kUtilityProcess;
149 } 166 }
150 167
151 } // namespace extensions 168 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698