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