OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/shell/shell_browser_main_parts.h" | 5 #include "apps/shell/shell_browser_main_parts.h" |
6 | 6 |
7 #include "apps/shell/shell_browser_context.h" | 7 #include "apps/shell/shell_browser_context.h" |
8 #include "apps/shell/shell_extension_system.h" | 8 #include "apps/shell/shell_extension_system.h" |
9 #include "apps/shell/shell_extensions_browser_client.h" | 9 #include "apps/shell/shell_extensions_browser_client.h" |
10 #include "apps/shell/shell_extensions_client.h" | 10 #include "apps/shell/shell_extensions_client.h" |
11 #include "apps/shell/web_view_window.h" | 11 #include "apps/shell/web_view_window.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/path_service.h" | |
16 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
17 #include "chrome/common/chrome_paths.h" | |
18 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 16 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
19 #include "content/public/common/result_codes.h" | 17 #include "content/public/common/result_codes.h" |
20 #include "extensions/browser/extension_system.h" | 18 #include "extensions/browser/extension_system.h" |
21 #include "extensions/browser/renderer_startup_helper.h" | 19 #include "extensions/browser/renderer_startup_helper.h" |
22 #include "extensions/common/extension_paths.h" | |
23 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
24 #include "ui/aura/root_window.h" | 21 #include "ui/aura/root_window.h" |
25 #include "ui/aura/test/test_screen.h" | 22 #include "ui/aura/test/test_screen.h" |
26 #include "ui/base/ime/input_method_initializer.h" | 23 #include "ui/base/ime/input_method_initializer.h" |
27 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
28 #include "ui/gfx/screen.h" | 25 #include "ui/gfx/screen.h" |
29 #include "ui/wm/test/wm_test_helper.h" | 26 #include "ui/wm/test/wm_test_helper.h" |
30 | 27 |
31 #if defined(OS_CHROMEOS) | |
32 #include "chromeos/chromeos_paths.h" | |
33 #endif | |
34 | |
35 using content::BrowserContext; | 28 using content::BrowserContext; |
36 using extensions::Extension; | 29 using extensions::Extension; |
37 using extensions::ExtensionSystem; | 30 using extensions::ExtensionSystem; |
38 using extensions::ShellExtensionSystem; | 31 using extensions::ShellExtensionSystem; |
39 | 32 |
40 namespace apps { | 33 namespace apps { |
41 namespace { | 34 namespace { |
42 | 35 |
43 // Register additional BrowserContextKeyedService factories here. See | 36 // Register additional BrowserContextKeyedService factories here. See |
44 // ChromeBrowserMainExtraPartsProfiles for details. | 37 // ChromeBrowserMainExtraPartsProfiles for details. |
(...skipping 23 matching lines...) Expand all Loading... |
68 | 61 |
69 int ShellBrowserMainParts::PreCreateThreads() { | 62 int ShellBrowserMainParts::PreCreateThreads() { |
70 // TODO(jamescook): Initialize chromeos::CrosSettings here? | 63 // TODO(jamescook): Initialize chromeos::CrosSettings here? |
71 | 64 |
72 // Return no error. | 65 // Return no error. |
73 return 0; | 66 return 0; |
74 } | 67 } |
75 | 68 |
76 void ShellBrowserMainParts::PreMainMessageLoopRun() { | 69 void ShellBrowserMainParts::PreMainMessageLoopRun() { |
77 // NOTE: Much of this is culled from chrome/test/base/chrome_test_suite.cc | 70 // NOTE: Much of this is culled from chrome/test/base/chrome_test_suite.cc |
78 // Set up all the paths to load files. | |
79 chrome::RegisterPathProvider(); | |
80 #if defined(OS_CHROMEOS) | |
81 chromeos::RegisterPathProvider(); | |
82 #endif | |
83 extensions::RegisterPathProvider(); | |
84 | |
85 // The extensions system needs manifest data from the Chrome PAK file. | |
86 base::FilePath resources_pack_path; | |
87 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | |
88 ResourceBundle::GetSharedInstance().AddDataPackFromPath( | |
89 resources_pack_path, ui::SCALE_FACTOR_NONE); | |
90 | 71 |
91 // TODO(jamescook): Initialize chromeos::UserManager. | 72 // TODO(jamescook): Initialize chromeos::UserManager. |
92 | 73 |
93 // Initialize our "profile" equivalent. | 74 // Initialize our "profile" equivalent. |
94 browser_context_.reset(new ShellBrowserContext); | 75 browser_context_.reset(new ShellBrowserContext); |
95 | 76 |
96 extensions_client_.reset(new ShellExtensionsClient()); | 77 extensions_client_.reset(new ShellExtensionsClient()); |
97 extensions::ExtensionsClient::Set(extensions_client_.get()); | 78 extensions::ExtensionsClient::Set(extensions_client_.get()); |
98 | 79 |
99 extensions_browser_client_.reset( | 80 extensions_browser_client_.reset( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 151 } |
171 | 152 |
172 void ShellBrowserMainParts::CreateExtensionSystem() { | 153 void ShellBrowserMainParts::CreateExtensionSystem() { |
173 DCHECK(browser_context_); | 154 DCHECK(browser_context_); |
174 extension_system_ = static_cast<ShellExtensionSystem*>( | 155 extension_system_ = static_cast<ShellExtensionSystem*>( |
175 ExtensionSystem::Get(browser_context_.get())); | 156 ExtensionSystem::Get(browser_context_.get())); |
176 extension_system_->InitForRegularProfile(true); | 157 extension_system_->InitForRegularProfile(true); |
177 } | 158 } |
178 | 159 |
179 } // namespace apps | 160 } // namespace apps |
OLD | NEW |