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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const content::MainFunctionParams& parameters, | 73 const content::MainFunctionParams& parameters, |
74 ShellBrowserMainDelegate* browser_main_delegate) | 74 ShellBrowserMainDelegate* browser_main_delegate) |
75 : devtools_http_handler_(nullptr), | 75 : devtools_http_handler_(nullptr), |
76 extension_system_(nullptr), | 76 extension_system_(nullptr), |
77 parameters_(parameters), | 77 parameters_(parameters), |
78 run_message_loop_(true), | 78 run_message_loop_(true), |
79 browser_main_delegate_(browser_main_delegate) { | 79 browser_main_delegate_(browser_main_delegate) { |
80 } | 80 } |
81 | 81 |
82 ShellBrowserMainParts::~ShellBrowserMainParts() { | 82 ShellBrowserMainParts::~ShellBrowserMainParts() { |
83 if (devtools_http_handler_) { | 83 DCHECK(!devtools_http_handler_); |
84 // Note that Stop destroys devtools_http_handler_. | |
85 devtools_http_handler_->Stop(); | |
86 } | |
87 } | 84 } |
88 | 85 |
89 void ShellBrowserMainParts::PreMainMessageLoopStart() { | 86 void ShellBrowserMainParts::PreMainMessageLoopStart() { |
90 // TODO(jamescook): Initialize touch here? | 87 // TODO(jamescook): Initialize touch here? |
91 } | 88 } |
92 | 89 |
93 void ShellBrowserMainParts::PostMainMessageLoopStart() { | 90 void ShellBrowserMainParts::PostMainMessageLoopStart() { |
94 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
95 // Perform initialization of D-Bus objects here rather than in the below | 92 // Perform initialization of D-Bus objects here rather than in the below |
96 // helper classes so those classes' tests can initialize stub versions of the | 93 // helper classes so those classes' tests can initialize stub versions of the |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return true; | 212 return true; |
216 // TODO(yoz): just return false here? | 213 // TODO(yoz): just return false here? |
217 base::RunLoop run_loop; | 214 base::RunLoop run_loop; |
218 run_loop.Run(); | 215 run_loop.Run(); |
219 *result_code = content::RESULT_CODE_NORMAL_EXIT; | 216 *result_code = content::RESULT_CODE_NORMAL_EXIT; |
220 return true; | 217 return true; |
221 } | 218 } |
222 | 219 |
223 void ShellBrowserMainParts::PostMainMessageLoopRun() { | 220 void ShellBrowserMainParts::PostMainMessageLoopRun() { |
224 browser_main_delegate_->Shutdown(); | 221 browser_main_delegate_->Shutdown(); |
| 222 if (devtools_http_handler_) { |
| 223 // Note that Stop destroys devtools_http_handler_. |
| 224 devtools_http_handler_->Stop(); |
| 225 devtools_http_handler_ = nullptr; |
| 226 } |
225 | 227 |
226 #if !defined(DISABLE_NACL) | 228 #if !defined(DISABLE_NACL) |
227 task_tracker_.TryCancelAll(); | 229 task_tracker_.TryCancelAll(); |
228 nacl::NaClBrowser::SetDelegate(nullptr); | 230 nacl::NaClBrowser::SetDelegate(nullptr); |
229 #endif | 231 #endif |
230 | 232 |
231 oauth2_token_service_.reset(); | 233 oauth2_token_service_.reset(); |
232 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( | 234 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( |
233 browser_context_.get()); | 235 browser_context_.get()); |
234 extension_system_ = NULL; | 236 extension_system_ = NULL; |
(...skipping 17 matching lines...) Expand all Loading... |
252 } | 254 } |
253 | 255 |
254 void ShellBrowserMainParts::CreateExtensionSystem() { | 256 void ShellBrowserMainParts::CreateExtensionSystem() { |
255 DCHECK(browser_context_); | 257 DCHECK(browser_context_); |
256 extension_system_ = static_cast<ShellExtensionSystem*>( | 258 extension_system_ = static_cast<ShellExtensionSystem*>( |
257 ExtensionSystem::Get(browser_context_.get())); | 259 ExtensionSystem::Get(browser_context_.get())); |
258 extension_system_->InitForRegularProfile(true); | 260 extension_system_->InitForRegularProfile(true); |
259 } | 261 } |
260 | 262 |
261 } // namespace extensions | 263 } // namespace extensions |
OLD | NEW |