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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "chrome/browser/extensions/updater/extension_cache.h" | 50 #include "chrome/browser/extensions/updater/extension_cache.h" |
51 #include "chrome/browser/extensions/updater/extension_updater.h" | 51 #include "chrome/browser/extensions/updater/extension_updater.h" |
52 #include "chrome/browser/profiles/profile.h" | 52 #include "chrome/browser/profiles/profile.h" |
53 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 53 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
54 #include "chrome/browser/ui/webui/favicon_source.h" | 54 #include "chrome/browser/ui/webui/favicon_source.h" |
55 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 55 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
56 #include "chrome/browser/ui/webui/theme_source.h" | 56 #include "chrome/browser/ui/webui/theme_source.h" |
57 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
58 #include "chrome/common/crash_keys.h" | 58 #include "chrome/common/crash_keys.h" |
59 #include "chrome/common/extensions/extension_constants.h" | 59 #include "chrome/common/extensions/extension_constants.h" |
60 #include "chrome/common/extensions/extension_file_util.h" | |
61 #include "chrome/common/extensions/features/feature_channel.h" | 60 #include "chrome/common/extensions/features/feature_channel.h" |
62 #include "chrome/common/extensions/manifest_url_handler.h" | 61 #include "chrome/common/extensions/manifest_url_handler.h" |
63 #include "chrome/common/pref_names.h" | 62 #include "chrome/common/pref_names.h" |
64 #include "chrome/common/url_constants.h" | 63 #include "chrome/common/url_constants.h" |
65 #include "components/startup_metric_utils/startup_metric_utils.h" | 64 #include "components/startup_metric_utils/startup_metric_utils.h" |
66 #include "content/public/browser/browser_thread.h" | 65 #include "content/public/browser/browser_thread.h" |
67 #include "content/public/browser/devtools_agent_host.h" | 66 #include "content/public/browser/devtools_agent_host.h" |
68 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
69 #include "content/public/browser/notification_types.h" | 68 #include "content/public/browser/notification_types.h" |
70 #include "content/public/browser/render_process_host.h" | 69 #include "content/public/browser/render_process_host.h" |
(...skipping 11 matching lines...) Expand all Loading... |
82 #include "extensions/browser/process_manager.h" | 81 #include "extensions/browser/process_manager.h" |
83 #include "extensions/browser/process_map.h" | 82 #include "extensions/browser/process_map.h" |
84 #include "extensions/browser/runtime_data.h" | 83 #include "extensions/browser/runtime_data.h" |
85 #include "extensions/browser/update_observer.h" | 84 #include "extensions/browser/update_observer.h" |
86 #include "extensions/common/constants.h" | 85 #include "extensions/common/constants.h" |
87 #include "extensions/common/error_utils.h" | 86 #include "extensions/common/error_utils.h" |
88 #include "extensions/common/extension.h" | 87 #include "extensions/common/extension.h" |
89 #include "extensions/common/extension_messages.h" | 88 #include "extensions/common/extension_messages.h" |
90 #include "extensions/common/extensions_client.h" | 89 #include "extensions/common/extensions_client.h" |
91 #include "extensions/common/feature_switch.h" | 90 #include "extensions/common/feature_switch.h" |
| 91 #include "extensions/common/file_util.h" |
92 #include "extensions/common/manifest.h" | 92 #include "extensions/common/manifest.h" |
93 #include "extensions/common/manifest_constants.h" | 93 #include "extensions/common/manifest_constants.h" |
94 #include "extensions/common/manifest_handlers/background_info.h" | 94 #include "extensions/common/manifest_handlers/background_info.h" |
95 #include "extensions/common/manifest_handlers/incognito_info.h" | 95 #include "extensions/common/manifest_handlers/incognito_info.h" |
96 #include "extensions/common/manifest_handlers/shared_module_info.h" | 96 #include "extensions/common/manifest_handlers/shared_module_info.h" |
97 #include "extensions/common/permissions/permission_message_provider.h" | 97 #include "extensions/common/permissions/permission_message_provider.h" |
98 #include "extensions/common/permissions/permissions_data.h" | 98 #include "extensions/common/permissions/permissions_data.h" |
99 #include "grit/generated_resources.h" | 99 #include "grit/generated_resources.h" |
100 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 100 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
101 #include "ui/base/webui/web_ui_util.h" | 101 #include "ui/base/webui/web_ui_util.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 553 |
554 const Extension* extension = GetInstalledExtension(id); | 554 const Extension* extension = GetInstalledExtension(id); |
555 if (!pending_extension_info && !extension) { | 555 if (!pending_extension_info && !extension) { |
556 LOG(WARNING) << "Will not update extension " << id | 556 LOG(WARNING) << "Will not update extension " << id |
557 << " because it is not installed or pending"; | 557 << " because it is not installed or pending"; |
558 // Delete extension_path since we're not creating a CrxInstaller | 558 // Delete extension_path since we're not creating a CrxInstaller |
559 // that would do it for us. | 559 // that would do it for us. |
560 if (!GetFileTaskRunner()->PostTask( | 560 if (!GetFileTaskRunner()->PostTask( |
561 FROM_HERE, | 561 FROM_HERE, |
562 base::Bind( | 562 base::Bind( |
563 &extension_file_util::DeleteFile, extension_path, false))) | 563 &extensions::file_util::DeleteFile, extension_path, false))) |
564 NOTREACHED(); | 564 NOTREACHED(); |
565 | 565 |
566 return false; | 566 return false; |
567 } | 567 } |
568 | 568 |
569 // We want a silent install only for non-pending extensions and | 569 // We want a silent install only for non-pending extensions and |
570 // pending extensions that have install_silently set. | 570 // pending extensions that have install_silently set. |
571 scoped_ptr<ExtensionInstallPrompt> client; | 571 scoped_ptr<ExtensionInstallPrompt> client; |
572 if (pending_extension_info && !pending_extension_info->install_silently()) | 572 if (pending_extension_info && !pending_extension_info->install_silently()) |
573 client.reset(ExtensionInstallUI::CreateInstallPromptWithProfile(profile_)); | 573 client.reset(ExtensionInstallUI::CreateInstallPromptWithProfile(profile_)); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 "Extensions.Permissions_Uninstall"); | 756 "Extensions.Permissions_Uninstall"); |
757 | 757 |
758 // Unload before doing more cleanup to ensure that nothing is hanging on to | 758 // Unload before doing more cleanup to ensure that nothing is hanging on to |
759 // any of these resources. | 759 // any of these resources. |
760 UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_UNINSTALL); | 760 UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_UNINSTALL); |
761 | 761 |
762 // Tell the backend to start deleting installed extensions on the file thread. | 762 // Tell the backend to start deleting installed extensions on the file thread. |
763 if (!Manifest::IsUnpackedLocation(extension->location())) { | 763 if (!Manifest::IsUnpackedLocation(extension->location())) { |
764 if (!GetFileTaskRunner()->PostTask( | 764 if (!GetFileTaskRunner()->PostTask( |
765 FROM_HERE, | 765 FROM_HERE, |
766 base::Bind( | 766 base::Bind(&extensions::file_util::UninstallExtension, |
767 &extension_file_util::UninstallExtension, | 767 install_directory_, |
768 install_directory_, | 768 extension_id))) |
769 extension_id))) | |
770 NOTREACHED(); | 769 NOTREACHED(); |
771 } | 770 } |
772 | 771 |
773 // Do not remove the data of ephemeral apps. They will be garbage collected by | 772 // Do not remove the data of ephemeral apps. They will be garbage collected by |
774 // EphemeralAppService. | 773 // EphemeralAppService. |
775 if (!extension->is_ephemeral()) | 774 if (!extension->is_ephemeral()) |
776 extensions::DataDeleter::StartDeleting(profile_, extension.get()); | 775 extensions::DataDeleter::StartDeleting(profile_, extension.get()); |
777 | 776 |
778 UntrackTerminatedExtension(extension_id); | 777 UntrackTerminatedExtension(extension_id); |
779 | 778 |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 LOG(WARNING) << "ShouldAllowInstall() returned false for " | 1746 LOG(WARNING) << "ShouldAllowInstall() returned false for " |
1748 << id << " of type " << extension->GetType() | 1747 << id << " of type " << extension->GetType() |
1749 << " and update URL " | 1748 << " and update URL " |
1750 << extensions::ManifestURL::GetUpdateURL(extension).spec() | 1749 << extensions::ManifestURL::GetUpdateURL(extension).spec() |
1751 << "; not installing"; | 1750 << "; not installing"; |
1752 | 1751 |
1753 // Delete the extension directory since we're not going to | 1752 // Delete the extension directory since we're not going to |
1754 // load it. | 1753 // load it. |
1755 if (!GetFileTaskRunner()->PostTask( | 1754 if (!GetFileTaskRunner()->PostTask( |
1756 FROM_HERE, | 1755 FROM_HERE, |
1757 base::Bind(&extension_file_util::DeleteFile, | 1756 base::Bind(&extensions::file_util::DeleteFile, |
1758 extension->path(), true))) { | 1757 extension->path(), |
| 1758 true))) { |
1759 NOTREACHED(); | 1759 NOTREACHED(); |
1760 } | 1760 } |
1761 return; | 1761 return; |
1762 } | 1762 } |
1763 | 1763 |
1764 install_parameter = pending_extension_info->install_parameter(); | 1764 install_parameter = pending_extension_info->install_parameter(); |
1765 pending_extension_manager()->Remove(id); | 1765 pending_extension_manager()->Remove(id); |
1766 } else { | 1766 } else { |
1767 // We explicitly want to re-enable an uninstalled external | 1767 // We explicitly want to re-enable an uninstalled external |
1768 // extension; if we're here, that means the user is manually | 1768 // extension; if we're here, that means the user is manually |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 void ExtensionService::UnloadAllExtensionsInternal() { | 2472 void ExtensionService::UnloadAllExtensionsInternal() { |
2473 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); | 2473 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); |
2474 | 2474 |
2475 registry_->ClearAll(); | 2475 registry_->ClearAll(); |
2476 system_->runtime_data()->ClearAll(); | 2476 system_->runtime_data()->ClearAll(); |
2477 | 2477 |
2478 // TODO(erikkay) should there be a notification for this? We can't use | 2478 // TODO(erikkay) should there be a notification for this? We can't use |
2479 // EXTENSION_UNLOADED since that implies that the extension has been disabled | 2479 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
2480 // or uninstalled. | 2480 // or uninstalled. |
2481 } | 2481 } |
OLD | NEW |