OLD | NEW |
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 Loading... |
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->DisconnectRenderViewHost(); |
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); |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |