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/browser/shell_browser_main_parts.h" | 5 #include "apps/shell/browser/shell_browser_main_parts.h" |
6 | 6 |
7 #include "apps/shell/browser/shell_browser_context.h" | 7 #include "apps/shell/browser/shell_browser_context.h" |
8 #include "apps/shell/browser/shell_extension_system.h" | 8 #include "apps/shell/browser/shell_extension_system.h" |
| 9 #include "apps/shell/browser/shell_extension_system_factory.h" |
9 #include "apps/shell/browser/shell_extensions_browser_client.h" | 10 #include "apps/shell/browser/shell_extensions_browser_client.h" |
10 #include "apps/shell/browser/web_view_window.h" | 11 #include "apps/shell/browser/web_view_window.h" |
11 #include "apps/shell/common/shell_extensions_client.h" | 12 #include "apps/shell/common/shell_extensions_client.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/file_util.h" | 14 #include "base/file_util.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 17 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
17 #include "content/public/common/result_codes.h" | 18 #include "content/public/common/result_codes.h" |
18 #include "extensions/browser/extension_system.h" | 19 #include "extensions/browser/extension_system.h" |
(...skipping 14 matching lines...) Expand all Loading... |
33 using extensions::ExtensionSystem; | 34 using extensions::ExtensionSystem; |
34 using extensions::ShellExtensionSystem; | 35 using extensions::ShellExtensionSystem; |
35 | 36 |
36 namespace apps { | 37 namespace apps { |
37 namespace { | 38 namespace { |
38 | 39 |
39 // Register additional BrowserContextKeyedService factories here. See | 40 // Register additional BrowserContextKeyedService factories here. See |
40 // ChromeBrowserMainExtraPartsProfiles for details. | 41 // ChromeBrowserMainExtraPartsProfiles for details. |
41 void EnsureBrowserContextKeyedServiceFactoriesBuilt() { | 42 void EnsureBrowserContextKeyedServiceFactoriesBuilt() { |
42 extensions::RendererStartupHelperFactory::GetInstance(); | 43 extensions::RendererStartupHelperFactory::GetInstance(); |
| 44 extensions::ShellExtensionSystemFactory::GetInstance(); |
43 } | 45 } |
44 | 46 |
45 // A ViewsDelegate to attach new unparented windows to app_shell's root window. | 47 // A ViewsDelegate to attach new unparented windows to app_shell's root window. |
46 class ShellViewsDelegate : public views::TestViewsDelegate { | 48 class ShellViewsDelegate : public views::TestViewsDelegate { |
47 public: | 49 public: |
48 explicit ShellViewsDelegate(aura::Window* root_window) | 50 explicit ShellViewsDelegate(aura::Window* root_window) |
49 : root_window_(root_window) {} | 51 : root_window_(root_window) {} |
50 virtual ~ShellViewsDelegate() {} | 52 virtual ~ShellViewsDelegate() {} |
51 | 53 |
52 // views::ViewsDelegate implementation. | 54 // views::ViewsDelegate implementation. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 102 |
101 extensions_client_.reset(new ShellExtensionsClient()); | 103 extensions_client_.reset(new ShellExtensionsClient()); |
102 extensions::ExtensionsClient::Set(extensions_client_.get()); | 104 extensions::ExtensionsClient::Set(extensions_client_.get()); |
103 | 105 |
104 extensions_browser_client_.reset( | 106 extensions_browser_client_.reset( |
105 new extensions::ShellExtensionsBrowserClient(browser_context_.get())); | 107 new extensions::ShellExtensionsBrowserClient(browser_context_.get())); |
106 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); | 108 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); |
107 | 109 |
108 // Create our custom ExtensionSystem first because other | 110 // Create our custom ExtensionSystem first because other |
109 // BrowserContextKeyedServices depend on it. | 111 // BrowserContextKeyedServices depend on it. |
| 112 // TODO(yoz): Move this after EnsureBrowserContextKeyedServiceFactoriesBuilt. |
110 CreateExtensionSystem(); | 113 CreateExtensionSystem(); |
111 | 114 |
112 EnsureBrowserContextKeyedServiceFactoriesBuilt(); | 115 EnsureBrowserContextKeyedServiceFactoriesBuilt(); |
113 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( | 116 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( |
114 browser_context_.get()); | 117 browser_context_.get()); |
115 | 118 |
116 CreateRootWindow(); | 119 CreateRootWindow(); |
117 CreateViewsDelegate(); | 120 CreateViewsDelegate(); |
118 | 121 |
119 const std::string kAppSwitch = "app"; | 122 const std::string kAppSwitch = "app"; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 191 } |
189 | 192 |
190 void ShellBrowserMainParts::CreateExtensionSystem() { | 193 void ShellBrowserMainParts::CreateExtensionSystem() { |
191 DCHECK(browser_context_); | 194 DCHECK(browser_context_); |
192 extension_system_ = static_cast<ShellExtensionSystem*>( | 195 extension_system_ = static_cast<ShellExtensionSystem*>( |
193 ExtensionSystem::Get(browser_context_.get())); | 196 ExtensionSystem::Get(browser_context_.get())); |
194 extension_system_->InitForRegularProfile(true); | 197 extension_system_->InitForRegularProfile(true); |
195 } | 198 } |
196 | 199 |
197 } // namespace apps | 200 } // namespace apps |
OLD | NEW |