| 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 25 matching lines...) Expand all Loading... |
| 83 #include "chrome/common/url_constants.h" | 82 #include "chrome/common/url_constants.h" |
| 84 #include "components/startup_metric_utils/startup_metric_utils.h" | 83 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 85 #include "content/public/browser/browser_thread.h" | 84 #include "content/public/browser/browser_thread.h" |
| 86 #include "content/public/browser/devtools_agent_host.h" | 85 #include "content/public/browser/devtools_agent_host.h" |
| 87 #include "content/public/browser/notification_service.h" | 86 #include "content/public/browser/notification_service.h" |
| 88 #include "content/public/browser/notification_types.h" | 87 #include "content/public/browser/notification_types.h" |
| 89 #include "content/public/browser/render_process_host.h" | 88 #include "content/public/browser/render_process_host.h" |
| 90 #include "content/public/browser/site_instance.h" | 89 #include "content/public/browser/site_instance.h" |
| 91 #include "content/public/browser/storage_partition.h" | 90 #include "content/public/browser/storage_partition.h" |
| 92 #include "content/public/browser/url_data_source.h" | 91 #include "content/public/browser/url_data_source.h" |
| 92 #include "extensions/browser/process_manager.h" |
| 93 #include "extensions/common/constants.h" | 93 #include "extensions/common/constants.h" |
| 94 #include "extensions/common/error_utils.h" | 94 #include "extensions/common/error_utils.h" |
| 95 #include "extensions/common/extensions_client.h" | 95 #include "extensions/common/extensions_client.h" |
| 96 #include "extensions/common/feature_switch.h" | 96 #include "extensions/common/feature_switch.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/background_info.h" | 99 #include "extensions/common/manifest_handlers/background_info.h" |
| 100 #include "extensions/common/manifest_handlers/incognito_info.h" | 100 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 101 #include "extensions/common/permissions/permission_message_provider.h" | 101 #include "extensions/common/permissions/permission_message_provider.h" |
| 102 #include "grit/generated_resources.h" | 102 #include "grit/generated_resources.h" |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 684 |
| 685 base::FilePath path; | 685 base::FilePath path; |
| 686 const Extension* current_extension = GetExtensionById(extension_id, false); | 686 const Extension* current_extension = GetExtensionById(extension_id, false); |
| 687 | 687 |
| 688 // Disable the extension if it's loaded. It might not be loaded if it crashed. | 688 // Disable the extension if it's loaded. It might not be loaded if it crashed. |
| 689 if (current_extension) { | 689 if (current_extension) { |
| 690 // If the extension has an inspector open for its background page, detach | 690 // If the extension has an inspector open for its background page, detach |
| 691 // the inspector and hang onto a cookie for it, so that we can reattach | 691 // the inspector and hang onto a cookie for it, so that we can reattach |
| 692 // later. | 692 // later. |
| 693 // TODO(yoz): this is not incognito-safe! | 693 // TODO(yoz): this is not incognito-safe! |
| 694 ExtensionProcessManager* manager = system_->process_manager(); | 694 extensions::ProcessManager* manager = system_->process_manager(); |
| 695 extensions::ExtensionHost* host = | 695 extensions::ExtensionHost* host = |
| 696 manager->GetBackgroundHostForExtension(extension_id); | 696 manager->GetBackgroundHostForExtension(extension_id); |
| 697 if (host && DevToolsAgentHost::HasFor(host->render_view_host())) { | 697 if (host && DevToolsAgentHost::HasFor(host->render_view_host())) { |
| 698 // Look for an open inspector for the background page. | 698 // Look for an open inspector for the background page. |
| 699 scoped_refptr<DevToolsAgentHost> agent_host = | 699 scoped_refptr<DevToolsAgentHost> agent_host = |
| 700 DevToolsAgentHost::GetOrCreateFor(host->render_view_host()); | 700 DevToolsAgentHost::GetOrCreateFor(host->render_view_host()); |
| 701 agent_host->DisconnectRenderViewHost(); | 701 agent_host->DisconnectRenderViewHost(); |
| 702 orphaned_dev_tools_[extension_id] = agent_host; | 702 orphaned_dev_tools_[extension_id] = agent_host; |
| 703 } | 703 } |
| 704 | 704 |
| (...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 Manifest::IsExternalLocation(extension->location()) && | 2662 Manifest::IsExternalLocation(extension->location()) && |
| 2663 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { | 2663 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { |
| 2664 return false; | 2664 return false; |
| 2665 } | 2665 } |
| 2666 } | 2666 } |
| 2667 | 2667 |
| 2668 return true; | 2668 return true; |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 bool ExtensionService::IsExtensionIdle(const std::string& extension_id) const { | 2671 bool ExtensionService::IsExtensionIdle(const std::string& extension_id) const { |
| 2672 ExtensionProcessManager* process_manager = system_->process_manager(); | 2672 extensions::ProcessManager* process_manager = system_->process_manager(); |
| 2673 DCHECK(process_manager); | 2673 DCHECK(process_manager); |
| 2674 extensions::ExtensionHost* host = | 2674 extensions::ExtensionHost* host = |
| 2675 process_manager->GetBackgroundHostForExtension(extension_id); | 2675 process_manager->GetBackgroundHostForExtension(extension_id); |
| 2676 if (host) | 2676 if (host) |
| 2677 return false; | 2677 return false; |
| 2678 | 2678 |
| 2679 content::SiteInstance* site_instance = process_manager->GetSiteInstanceForURL( | 2679 content::SiteInstance* site_instance = process_manager->GetSiteInstanceForURL( |
| 2680 Extension::GetBaseURLFromExtensionId(extension_id)); | 2680 Extension::GetBaseURLFromExtensionId(extension_id)); |
| 2681 if (site_instance && site_instance->HasProcess()) { | 2681 if (site_instance && site_instance->HasProcess()) { |
| 2682 return false; | 2682 return false; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2804 } | 2804 } |
| 2805 | 2805 |
| 2806 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 2806 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
| 2807 update_observers_.AddObserver(observer); | 2807 update_observers_.AddObserver(observer); |
| 2808 } | 2808 } |
| 2809 | 2809 |
| 2810 void ExtensionService::RemoveUpdateObserver( | 2810 void ExtensionService::RemoveUpdateObserver( |
| 2811 extensions::UpdateObserver* observer) { | 2811 extensions::UpdateObserver* observer) { |
| 2812 update_observers_.RemoveObserver(observer); | 2812 update_observers_.RemoveObserver(observer); |
| 2813 } | 2813 } |
| OLD | NEW |