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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 671763002: Extract ProcessManager from ExtensionSystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 std::string extension_id = transient_extension_id; 591 std::string extension_id = transient_extension_id;
592 const Extension* transient_current_extension = 592 const Extension* transient_current_extension =
593 GetExtensionById(extension_id, false); 593 GetExtensionById(extension_id, false);
594 594
595 // Disable the extension if it's loaded. It might not be loaded if it crashed. 595 // Disable the extension if it's loaded. It might not be loaded if it crashed.
596 if (transient_current_extension) { 596 if (transient_current_extension) {
597 // If the extension has an inspector open for its background page, detach 597 // If the extension has an inspector open for its background page, detach
598 // the inspector and hang onto a cookie for it, so that we can reattach 598 // the inspector and hang onto a cookie for it, so that we can reattach
599 // later. 599 // later.
600 // TODO(yoz): this is not incognito-safe! 600 // TODO(yoz): this is not incognito-safe!
601 extensions::ProcessManager* manager = system_->process_manager(); 601 extensions::ProcessManager* manager =
602 extensions::ProcessManager::Get(profile_);
602 extensions::ExtensionHost* host = 603 extensions::ExtensionHost* host =
603 manager->GetBackgroundHostForExtension(extension_id); 604 manager->GetBackgroundHostForExtension(extension_id);
604 if (host && DevToolsAgentHost::HasFor(host->host_contents())) { 605 if (host && DevToolsAgentHost::HasFor(host->host_contents())) {
605 // Look for an open inspector for the background page. 606 // Look for an open inspector for the background page.
606 scoped_refptr<DevToolsAgentHost> agent_host = 607 scoped_refptr<DevToolsAgentHost> agent_host =
607 DevToolsAgentHost::GetOrCreateFor(host->host_contents()); 608 DevToolsAgentHost::GetOrCreateFor(host->host_contents());
608 agent_host->DisconnectWebContents(); 609 agent_host->DisconnectWebContents();
609 orphaned_dev_tools_[extension_id] = agent_host; 610 orphaned_dev_tools_[extension_id] = agent_host;
610 } 611 }
611 612
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 } 2371 }
2371 2372
2372 void ExtensionService::OnProfileDestructionStarted() { 2373 void ExtensionService::OnProfileDestructionStarted() {
2373 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2374 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2374 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2375 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2375 it != ids_to_unload.end(); 2376 it != ids_to_unload.end();
2376 ++it) { 2377 ++it) {
2377 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2378 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2378 } 2379 }
2379 } 2380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698