| 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/browser_context_keyed_service_factories.h" | 7 #include "apps/browser_context_keyed_service_factories.h" |
| 8 #include "apps/shell/browser/shell_apps_client.h" | 8 #include "apps/shell/browser/shell_apps_client.h" |
| 9 #include "apps/shell/browser/shell_browser_context.h" | 9 #include "apps/shell/browser/shell_browser_context.h" |
| 10 #include "apps/shell/browser/shell_extension_system.h" | 10 #include "apps/shell/browser/shell_extension_system.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); | 70 DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 namespace apps { | 75 namespace apps { |
| 76 | 76 |
| 77 ShellBrowserMainParts::ShellBrowserMainParts( | 77 ShellBrowserMainParts::ShellBrowserMainParts( |
| 78 const content::MainFunctionParams& parameters) | 78 const content::MainFunctionParams& parameters) |
| 79 : extension_system_(NULL) { | 79 : extension_system_(NULL), parameters_(parameters) {} |
| 80 } | |
| 81 | 80 |
| 82 ShellBrowserMainParts::~ShellBrowserMainParts() { | 81 ShellBrowserMainParts::~ShellBrowserMainParts() { |
| 83 } | 82 } |
| 84 | 83 |
| 85 void ShellBrowserMainParts::PreMainMessageLoopStart() { | 84 void ShellBrowserMainParts::PreMainMessageLoopStart() { |
| 86 // TODO(jamescook): Initialize touch here? | 85 // TODO(jamescook): Initialize touch here? |
| 87 } | 86 } |
| 88 | 87 |
| 89 void ShellBrowserMainParts::PostMainMessageLoopStart() { | 88 void ShellBrowserMainParts::PostMainMessageLoopStart() { |
| 90 } | 89 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // TODO(yoz): Move this after EnsureBrowserContextKeyedServiceFactoriesBuilt. | 123 // TODO(yoz): Move this after EnsureBrowserContextKeyedServiceFactoriesBuilt. |
| 125 CreateExtensionSystem(); | 124 CreateExtensionSystem(); |
| 126 | 125 |
| 127 ::EnsureBrowserContextKeyedServiceFactoriesBuilt(); | 126 ::EnsureBrowserContextKeyedServiceFactoriesBuilt(); |
| 128 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( | 127 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( |
| 129 browser_context_.get()); | 128 browser_context_.get()); |
| 130 | 129 |
| 131 devtools_delegate_.reset( | 130 devtools_delegate_.reset( |
| 132 new content::ShellDevToolsDelegate(browser_context_.get())); | 131 new content::ShellDevToolsDelegate(browser_context_.get())); |
| 133 | 132 |
| 133 // For running browser tests. |
| 134 // TODO(yoz): This is set up to exit prematurely because we don't have |
| 135 // any tests yet. |
| 136 if (parameters_.ui_task) { |
| 137 parameters_.ui_task->Run(); |
| 138 delete parameters_.ui_task; |
| 139 return; |
| 140 } |
| 141 |
| 134 CreateRootWindow(); | 142 CreateRootWindow(); |
| 135 CreateViewsDelegate(); | 143 CreateViewsDelegate(); |
| 136 | 144 |
| 137 const std::string kAppSwitch = "app"; | 145 const std::string kAppSwitch = "app"; |
| 138 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 146 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 139 if (command_line->HasSwitch(kAppSwitch)) { | 147 if (command_line->HasSwitch(kAppSwitch)) { |
| 140 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch)); | 148 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch)); |
| 141 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); | 149 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); |
| 142 extension_system_->LoadAndLaunchApp(app_absolute_dir); | 150 extension_system_->LoadAndLaunchApp(app_absolute_dir); |
| 143 } else { | 151 } else { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 218 } |
| 211 | 219 |
| 212 void ShellBrowserMainParts::CreateExtensionSystem() { | 220 void ShellBrowserMainParts::CreateExtensionSystem() { |
| 213 DCHECK(browser_context_); | 221 DCHECK(browser_context_); |
| 214 extension_system_ = static_cast<ShellExtensionSystem*>( | 222 extension_system_ = static_cast<ShellExtensionSystem*>( |
| 215 ExtensionSystem::Get(browser_context_.get())); | 223 ExtensionSystem::Get(browser_context_.get())); |
| 216 extension_system_->InitForRegularProfile(true); | 224 extension_system_->InitForRegularProfile(true); |
| 217 } | 225 } |
| 218 | 226 |
| 219 } // namespace apps | 227 } // namespace apps |
| OLD | NEW |