Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: extensions/shell/browser/shell_browser_main_parts.cc

Issue 691863002: [DevTools] Remove DevToolsHttpHandler::Stop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@httpHandler
Patch Set: Rebased Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 std::string install_crx_id = 186 std::string install_crx_id =
187 cmd->GetSwitchValueASCII(switches::kAppShellInstallCrx); 187 cmd->GetSwitchValueASCII(switches::kAppShellInstallCrx);
188 if (install_crx_id.size() != 0) { 188 if (install_crx_id.size() != 0) {
189 CHECK(install_crx_id.size() == 32) 189 CHECK(install_crx_id.size() == 32)
190 << "Extension ID must be exactly 32 characters long."; 190 << "Extension ID must be exactly 32 characters long.";
191 UpdateService* update_service = UpdateService::Get(browser_context_.get()); 191 UpdateService* update_service = UpdateService::Get(browser_context_.get());
192 update_service->DownloadAndInstall(install_crx_id, 192 update_service->DownloadAndInstall(install_crx_id,
193 base::Bind(CrxInstallComplete)); 193 base::Bind(CrxInstallComplete));
194 } 194 }
195 195
196 // CreateHttpHandler retains ownership over DevToolsHttpHandler. 196 // CreateHttpHandler retains ownership over DevToolsHttpHandler.
James Cook 2014/11/13 20:44:01 nit: This comment is wrong. You can just delete it
197 devtools_http_handler_ = 197 devtools_http_handler_.reset(
198 content::ShellDevToolsManagerDelegate::CreateHttpHandler( 198 content::ShellDevToolsManagerDelegate::CreateHttpHandler(
199 browser_context_.get()); 199 browser_context_.get()));
200 if (parameters_.ui_task) { 200 if (parameters_.ui_task) {
201 // For running browser tests. 201 // For running browser tests.
202 parameters_.ui_task->Run(); 202 parameters_.ui_task->Run();
203 delete parameters_.ui_task; 203 delete parameters_.ui_task;
204 run_message_loop_ = false; 204 run_message_loop_ = false;
205 } else { 205 } else {
206 browser_main_delegate_->Start(browser_context_.get()); 206 browser_main_delegate_->Start(browser_context_.get());
207 } 207 }
208 } 208 }
209 209
210 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { 210 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
211 if (!run_message_loop_) 211 if (!run_message_loop_)
212 return true; 212 return true;
213 // TODO(yoz): just return false here? 213 // TODO(yoz): just return false here?
214 base::RunLoop run_loop; 214 base::RunLoop run_loop;
215 run_loop.Run(); 215 run_loop.Run();
216 *result_code = content::RESULT_CODE_NORMAL_EXIT; 216 *result_code = content::RESULT_CODE_NORMAL_EXIT;
217 return true; 217 return true;
218 } 218 }
219 219
220 void ShellBrowserMainParts::PostMainMessageLoopRun() { 220 void ShellBrowserMainParts::PostMainMessageLoopRun() {
221 browser_main_delegate_->Shutdown(); 221 browser_main_delegate_->Shutdown();
222 if (devtools_http_handler_) { 222 devtools_http_handler_.reset();
223 // Note that Stop destroys devtools_http_handler_.
224 devtools_http_handler_->Stop();
225 devtools_http_handler_ = nullptr;
226 }
227 223
228 #if !defined(DISABLE_NACL) 224 #if !defined(DISABLE_NACL)
229 task_tracker_.TryCancelAll(); 225 task_tracker_.TryCancelAll();
230 nacl::NaClBrowser::SetDelegate(nullptr); 226 nacl::NaClBrowser::SetDelegate(nullptr);
231 #endif 227 #endif
232 228
233 oauth2_token_service_.reset(); 229 oauth2_token_service_.reset();
234 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( 230 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
235 browser_context_.get()); 231 browser_context_.get());
236 extension_system_ = NULL; 232 extension_system_ = NULL;
(...skipping 17 matching lines...) Expand all
254 } 250 }
255 251
256 void ShellBrowserMainParts::CreateExtensionSystem() { 252 void ShellBrowserMainParts::CreateExtensionSystem() {
257 DCHECK(browser_context_); 253 DCHECK(browser_context_);
258 extension_system_ = static_cast<ShellExtensionSystem*>( 254 extension_system_ = static_cast<ShellExtensionSystem*>(
259 ExtensionSystem::Get(browser_context_.get())); 255 ExtensionSystem::Get(browser_context_.get()));
260 extension_system_->InitForRegularProfile(true); 256 extension_system_->InitForRegularProfile(true);
261 } 257 }
262 258
263 } // namespace extensions 259 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698