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

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

Issue 442303002: DevTools: migrate DevTools APIs to use WebContents instead of RenderViewHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 6 years, 4 months 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 | Annotate | Revision Log
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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 // Disable the extension if it's loaded. It might not be loaded if it crashed. 610 // Disable the extension if it's loaded. It might not be loaded if it crashed.
611 if (transient_current_extension) { 611 if (transient_current_extension) {
612 // If the extension has an inspector open for its background page, detach 612 // If the extension has an inspector open for its background page, detach
613 // the inspector and hang onto a cookie for it, so that we can reattach 613 // the inspector and hang onto a cookie for it, so that we can reattach
614 // later. 614 // later.
615 // TODO(yoz): this is not incognito-safe! 615 // TODO(yoz): this is not incognito-safe!
616 extensions::ProcessManager* manager = system_->process_manager(); 616 extensions::ProcessManager* manager = system_->process_manager();
617 extensions::ExtensionHost* host = 617 extensions::ExtensionHost* host =
618 manager->GetBackgroundHostForExtension(extension_id); 618 manager->GetBackgroundHostForExtension(extension_id);
619 if (host && DevToolsAgentHost::HasFor(host->render_view_host())) { 619 if (host && DevToolsAgentHost::HasFor(host->host_contents())) {
620 // Look for an open inspector for the background page. 620 // Look for an open inspector for the background page.
621 scoped_refptr<DevToolsAgentHost> agent_host = 621 scoped_refptr<DevToolsAgentHost> agent_host =
622 DevToolsAgentHost::GetOrCreateFor(host->render_view_host()); 622 DevToolsAgentHost::GetOrCreateFor(host->host_contents());
623 agent_host->DisconnectRenderViewHost(); 623 agent_host->DisconnectWebContents();
624 orphaned_dev_tools_[extension_id] = agent_host; 624 orphaned_dev_tools_[extension_id] = agent_host;
625 } 625 }
626 626
627 path = transient_current_extension->path(); 627 path = transient_current_extension->path();
628 // BeingUpgraded is set back to false when the extension is added. 628 // BeingUpgraded is set back to false when the extension is added.
629 system_->runtime_data()->SetBeingUpgraded(transient_current_extension, 629 system_->runtime_data()->SetBeingUpgraded(transient_current_extension,
630 true); 630 true);
631 DisableExtension(extension_id, Extension::DISABLE_RELOAD); 631 DisableExtension(extension_id, Extension::DISABLE_RELOAD);
632 reloading_extensions_.insert(extension_id); 632 reloading_extensions_.insert(extension_id);
633 } else { 633 } else {
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 #endif // defined(ENABLE_EXTENSIONS) 2019 #endif // defined(ENABLE_EXTENSIONS)
2020 } 2020 }
2021 2021
2022 void ExtensionService::DidCreateRenderViewForBackgroundPage( 2022 void ExtensionService::DidCreateRenderViewForBackgroundPage(
2023 extensions::ExtensionHost* host) { 2023 extensions::ExtensionHost* host) {
2024 OrphanedDevTools::iterator iter = 2024 OrphanedDevTools::iterator iter =
2025 orphaned_dev_tools_.find(host->extension_id()); 2025 orphaned_dev_tools_.find(host->extension_id());
2026 if (iter == orphaned_dev_tools_.end()) 2026 if (iter == orphaned_dev_tools_.end())
2027 return; 2027 return;
2028 2028
2029 iter->second->ConnectRenderViewHost(host->render_view_host()); 2029 iter->second->ConnectWebContents(host->host_contents());
2030 orphaned_dev_tools_.erase(iter); 2030 orphaned_dev_tools_.erase(iter);
2031 } 2031 }
2032 2032
2033 void ExtensionService::Observe(int type, 2033 void ExtensionService::Observe(int type,
2034 const content::NotificationSource& source, 2034 const content::NotificationSource& source,
2035 const content::NotificationDetails& details) { 2035 const content::NotificationDetails& details) {
2036 switch (type) { 2036 switch (type) {
2037 case chrome::NOTIFICATION_APP_TERMINATING: 2037 case chrome::NOTIFICATION_APP_TERMINATING:
2038 // Shutdown has started. Don't start any more extension installs. 2038 // Shutdown has started. Don't start any more extension installs.
2039 // (We cannot use ExtensionService::Shutdown() for this because it 2039 // (We cannot use ExtensionService::Shutdown() for this because it
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 } 2360 }
2361 2361
2362 void ExtensionService::OnProfileDestructionStarted() { 2362 void ExtensionService::OnProfileDestructionStarted() {
2363 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2363 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2364 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2364 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2365 it != ids_to_unload.end(); 2365 it != ids_to_unload.end();
2366 ++it) { 2366 ++it) {
2367 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2367 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2368 } 2368 }
2369 } 2369 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/devtools_util.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698