Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_browser_main_parts.h" | 5 #include "extensions/shell/browser/shell_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 10 #include "components/omaha_query_params/omaha_query_params.h" | 10 #include "components/omaha_query_params/omaha_query_params.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 const content::MainFunctionParams& parameters, | 64 const content::MainFunctionParams& parameters, |
| 65 ShellBrowserMainDelegate* browser_main_delegate) | 65 ShellBrowserMainDelegate* browser_main_delegate) |
| 66 : devtools_http_handler_(nullptr), | 66 : devtools_http_handler_(nullptr), |
| 67 extension_system_(nullptr), | 67 extension_system_(nullptr), |
| 68 parameters_(parameters), | 68 parameters_(parameters), |
| 69 run_message_loop_(true), | 69 run_message_loop_(true), |
| 70 browser_main_delegate_(browser_main_delegate) { | 70 browser_main_delegate_(browser_main_delegate) { |
| 71 } | 71 } |
| 72 | 72 |
| 73 ShellBrowserMainParts::~ShellBrowserMainParts() { | 73 ShellBrowserMainParts::~ShellBrowserMainParts() { |
| 74 if (devtools_http_handler_) { | 74 DCHECK(!devtools_http_handler_); |
| 75 // Note that Stop destroys devtools_http_handler_. | |
| 76 devtools_http_handler_->Stop(); | |
| 77 } | |
| 78 } | 75 } |
| 79 | 76 |
| 80 void ShellBrowserMainParts::PreMainMessageLoopStart() { | 77 void ShellBrowserMainParts::PreMainMessageLoopStart() { |
| 81 // TODO(jamescook): Initialize touch here? | 78 // TODO(jamescook): Initialize touch here? |
| 82 } | 79 } |
| 83 | 80 |
| 84 void ShellBrowserMainParts::PostMainMessageLoopStart() { | 81 void ShellBrowserMainParts::PostMainMessageLoopStart() { |
| 85 #if defined(OS_CHROMEOS) | 82 #if defined(OS_CHROMEOS) |
| 86 // Perform initialization of D-Bus objects here rather than in the below | 83 // Perform initialization of D-Bus objects here rather than in the below |
| 87 // helper classes so those classes' tests can initialize stub versions of the | 84 // helper classes so those classes' tests can initialize stub versions of the |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 task_tracker_.TryCancelAll(); | 204 task_tracker_.TryCancelAll(); |
| 208 nacl::NaClBrowser::SetDelegate(nullptr); | 205 nacl::NaClBrowser::SetDelegate(nullptr); |
| 209 #endif | 206 #endif |
| 210 | 207 |
| 211 oauth2_token_service_.reset(); | 208 oauth2_token_service_.reset(); |
| 212 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( | 209 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( |
| 213 browser_context_.get()); | 210 browser_context_.get()); |
| 214 extension_system_ = NULL; | 211 extension_system_ = NULL; |
| 215 ExtensionsBrowserClient::Set(NULL); | 212 ExtensionsBrowserClient::Set(NULL); |
| 216 extensions_browser_client_.reset(); | 213 extensions_browser_client_.reset(); |
| 214 if (devtools_http_handler_) { | |
|
James Cook
2014/11/11 18:32:31
If possible please move this to immediately after
vkuzkokov
2014/11/12 09:41:20
Moved.
| |
| 215 // Note that Stop destroys devtools_http_handler_. | |
| 216 devtools_http_handler_->Stop(); | |
| 217 devtools_http_handler_ = nullptr; | |
| 218 } | |
| 217 browser_context_.reset(); | 219 browser_context_.reset(); |
| 218 | 220 |
| 219 desktop_controller_.reset(); | 221 desktop_controller_.reset(); |
| 220 | 222 |
| 221 storage_monitor::StorageMonitor::Destroy(); | 223 storage_monitor::StorageMonitor::Destroy(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 void ShellBrowserMainParts::PostDestroyThreads() { | 226 void ShellBrowserMainParts::PostDestroyThreads() { |
| 225 #if defined(OS_CHROMEOS) | 227 #if defined(OS_CHROMEOS) |
| 226 audio_controller_.reset(); | 228 audio_controller_.reset(); |
| 227 chromeos::CrasAudioHandler::Shutdown(); | 229 chromeos::CrasAudioHandler::Shutdown(); |
| 228 network_controller_.reset(); | 230 network_controller_.reset(); |
| 229 chromeos::NetworkHandler::Shutdown(); | 231 chromeos::NetworkHandler::Shutdown(); |
| 230 chromeos::DBusThreadManager::Shutdown(); | 232 chromeos::DBusThreadManager::Shutdown(); |
| 231 #endif | 233 #endif |
| 232 } | 234 } |
| 233 | 235 |
| 234 void ShellBrowserMainParts::CreateExtensionSystem() { | 236 void ShellBrowserMainParts::CreateExtensionSystem() { |
| 235 DCHECK(browser_context_); | 237 DCHECK(browser_context_); |
| 236 extension_system_ = static_cast<ShellExtensionSystem*>( | 238 extension_system_ = static_cast<ShellExtensionSystem*>( |
| 237 ExtensionSystem::Get(browser_context_.get())); | 239 ExtensionSystem::Get(browser_context_.get())); |
| 238 extension_system_->InitForRegularProfile(true); | 240 extension_system_->InitForRegularProfile(true); |
| 239 } | 241 } |
| 240 | 242 |
| 241 } // namespace extensions | 243 } // namespace extensions |
| OLD | NEW |