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