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 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 37 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
38 #include "chrome/browser/extensions/component_loader.h" | 38 #include "chrome/browser/extensions/component_loader.h" |
39 #include "chrome/browser/extensions/crx_installer.h" | 39 #include "chrome/browser/extensions/crx_installer.h" |
40 #include "chrome/browser/extensions/data_deleter.h" | 40 #include "chrome/browser/extensions/data_deleter.h" |
41 #include "chrome/browser/extensions/event_router.h" | 41 #include "chrome/browser/extensions/event_router.h" |
42 #include "chrome/browser/extensions/extension_disabled_ui.h" | 42 #include "chrome/browser/extensions/extension_disabled_ui.h" |
43 #include "chrome/browser/extensions/extension_error_reporter.h" | 43 #include "chrome/browser/extensions/extension_error_reporter.h" |
44 #include "chrome/browser/extensions/extension_error_ui.h" | 44 #include "chrome/browser/extensions/extension_error_ui.h" |
45 #include "chrome/browser/extensions/extension_host.h" | 45 #include "chrome/browser/extensions/extension_host.h" |
46 #include "chrome/browser/extensions/extension_install_ui.h" | 46 #include "chrome/browser/extensions/extension_install_ui.h" |
47 #include "chrome/browser/extensions/extension_process_manager.h" | |
48 #include "chrome/browser/extensions/extension_sorting.h" | 47 #include "chrome/browser/extensions/extension_sorting.h" |
49 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 48 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
50 #include "chrome/browser/extensions/extension_sync_service.h" | 49 #include "chrome/browser/extensions/extension_sync_service.h" |
51 #include "chrome/browser/extensions/extension_system.h" | 50 #include "chrome/browser/extensions/extension_system.h" |
52 #include "chrome/browser/extensions/extension_util.h" | 51 #include "chrome/browser/extensions/extension_util.h" |
53 #include "chrome/browser/extensions/external_install_ui.h" | 52 #include "chrome/browser/extensions/external_install_ui.h" |
54 #include "chrome/browser/extensions/external_provider_impl.h" | 53 #include "chrome/browser/extensions/external_provider_impl.h" |
55 #include "chrome/browser/extensions/external_provider_interface.h" | 54 #include "chrome/browser/extensions/external_provider_interface.h" |
56 #include "chrome/browser/extensions/installed_loader.h" | 55 #include "chrome/browser/extensions/installed_loader.h" |
57 #include "chrome/browser/extensions/management_policy.h" | 56 #include "chrome/browser/extensions/management_policy.h" |
(...skipping 26 matching lines...) Expand all Loading... |
84 #include "chrome/common/url_constants.h" | 83 #include "chrome/common/url_constants.h" |
85 #include "components/startup_metric_utils/startup_metric_utils.h" | 84 #include "components/startup_metric_utils/startup_metric_utils.h" |
86 #include "content/public/browser/browser_thread.h" | 85 #include "content/public/browser/browser_thread.h" |
87 #include "content/public/browser/devtools_agent_host.h" | 86 #include "content/public/browser/devtools_agent_host.h" |
88 #include "content/public/browser/notification_service.h" | 87 #include "content/public/browser/notification_service.h" |
89 #include "content/public/browser/notification_types.h" | 88 #include "content/public/browser/notification_types.h" |
90 #include "content/public/browser/render_process_host.h" | 89 #include "content/public/browser/render_process_host.h" |
91 #include "content/public/browser/site_instance.h" | 90 #include "content/public/browser/site_instance.h" |
92 #include "content/public/browser/storage_partition.h" | 91 #include "content/public/browser/storage_partition.h" |
93 #include "content/public/browser/url_data_source.h" | 92 #include "content/public/browser/url_data_source.h" |
| 93 #include "extensions/browser/process_manager.h" |
94 #include "extensions/common/constants.h" | 94 #include "extensions/common/constants.h" |
95 #include "extensions/common/error_utils.h" | 95 #include "extensions/common/error_utils.h" |
96 #include "extensions/common/extensions_client.h" | 96 #include "extensions/common/extensions_client.h" |
97 #include "extensions/common/manifest.h" | 97 #include "extensions/common/manifest.h" |
98 #include "extensions/common/manifest_constants.h" | 98 #include "extensions/common/manifest_constants.h" |
99 #include "extensions/common/manifest_handlers/incognito_info.h" | 99 #include "extensions/common/manifest_handlers/incognito_info.h" |
100 #include "extensions/common/permissions/permission_message_provider.h" | 100 #include "extensions/common/permissions/permission_message_provider.h" |
101 #include "grit/generated_resources.h" | 101 #include "grit/generated_resources.h" |
102 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 102 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
103 #include "ui/base/webui/web_ui_util.h" | 103 #include "ui/base/webui/web_ui_util.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 683 |
684 base::FilePath path; | 684 base::FilePath path; |
685 const Extension* current_extension = GetExtensionById(extension_id, false); | 685 const Extension* current_extension = GetExtensionById(extension_id, false); |
686 | 686 |
687 // Disable the extension if it's loaded. It might not be loaded if it crashed. | 687 // Disable the extension if it's loaded. It might not be loaded if it crashed. |
688 if (current_extension) { | 688 if (current_extension) { |
689 // If the extension has an inspector open for its background page, detach | 689 // If the extension has an inspector open for its background page, detach |
690 // the inspector and hang onto a cookie for it, so that we can reattach | 690 // the inspector and hang onto a cookie for it, so that we can reattach |
691 // later. | 691 // later. |
692 // TODO(yoz): this is not incognito-safe! | 692 // TODO(yoz): this is not incognito-safe! |
693 ExtensionProcessManager* manager = system_->process_manager(); | 693 extensions::ProcessManager* manager = system_->process_manager(); |
694 extensions::ExtensionHost* host = | 694 extensions::ExtensionHost* host = |
695 manager->GetBackgroundHostForExtension(extension_id); | 695 manager->GetBackgroundHostForExtension(extension_id); |
696 if (host && DevToolsAgentHost::HasFor(host->render_view_host())) { | 696 if (host && DevToolsAgentHost::HasFor(host->render_view_host())) { |
697 // Look for an open inspector for the background page. | 697 // Look for an open inspector for the background page. |
698 scoped_refptr<DevToolsAgentHost> agent_host = | 698 scoped_refptr<DevToolsAgentHost> agent_host = |
699 DevToolsAgentHost::GetOrCreateFor(host->render_view_host()); | 699 DevToolsAgentHost::GetOrCreateFor(host->render_view_host()); |
700 agent_host->DisconnectRenderViewHost(); | 700 agent_host->DisconnectRenderViewHost(); |
701 orphaned_dev_tools_[extension_id] = agent_host; | 701 orphaned_dev_tools_[extension_id] = agent_host; |
702 } | 702 } |
703 | 703 |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2645 Manifest::IsExternalLocation(extension->location()) && | 2645 Manifest::IsExternalLocation(extension->location()) && |
2646 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { | 2646 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { |
2647 return false; | 2647 return false; |
2648 } | 2648 } |
2649 } | 2649 } |
2650 | 2650 |
2651 return true; | 2651 return true; |
2652 } | 2652 } |
2653 | 2653 |
2654 bool ExtensionService::IsExtensionIdle(const std::string& extension_id) const { | 2654 bool ExtensionService::IsExtensionIdle(const std::string& extension_id) const { |
2655 ExtensionProcessManager* process_manager = system_->process_manager(); | 2655 extensions::ProcessManager* process_manager = system_->process_manager(); |
2656 DCHECK(process_manager); | 2656 DCHECK(process_manager); |
2657 extensions::ExtensionHost* host = | 2657 extensions::ExtensionHost* host = |
2658 process_manager->GetBackgroundHostForExtension(extension_id); | 2658 process_manager->GetBackgroundHostForExtension(extension_id); |
2659 if (host) | 2659 if (host) |
2660 return false; | 2660 return false; |
2661 | 2661 |
2662 content::SiteInstance* site_instance = process_manager->GetSiteInstanceForURL( | 2662 content::SiteInstance* site_instance = process_manager->GetSiteInstanceForURL( |
2663 Extension::GetBaseURLFromExtensionId(extension_id)); | 2663 Extension::GetBaseURLFromExtensionId(extension_id)); |
2664 if (site_instance && site_instance->HasProcess()) { | 2664 if (site_instance && site_instance->HasProcess()) { |
2665 return false; | 2665 return false; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 } | 2787 } |
2788 | 2788 |
2789 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 2789 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
2790 update_observers_.AddObserver(observer); | 2790 update_observers_.AddObserver(observer); |
2791 } | 2791 } |
2792 | 2792 |
2793 void ExtensionService::RemoveUpdateObserver( | 2793 void ExtensionService::RemoveUpdateObserver( |
2794 extensions::UpdateObserver* observer) { | 2794 extensions::UpdateObserver* observer) { |
2795 update_observers_.RemoveObserver(observer); | 2795 update_observers_.RemoveObserver(observer); |
2796 } | 2796 } |
OLD | NEW |