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

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

Issue 123733003: Get ride of chrome.storage.* data when removing an application. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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" 60 #include "chrome/common/extensions/extension_file_util.h"
61 #include "chrome/common/extensions/extension_messages.h" 61 #include "chrome/common/extensions/extension_messages.h"
62 #include "chrome/common/extensions/features/feature_channel.h" 62 #include "chrome/common/extensions/features/feature_channel.h"
63 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" 63 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
64 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
65 #include "chrome/common/extensions/manifest_url_handler.h" 64 #include "chrome/common/extensions/manifest_url_handler.h"
66 #include "chrome/common/pref_names.h" 65 #include "chrome/common/pref_names.h"
67 #include "chrome/common/url_constants.h" 66 #include "chrome/common/url_constants.h"
68 #include "components/startup_metric_utils/startup_metric_utils.h" 67 #include "components/startup_metric_utils/startup_metric_utils.h"
69 #include "content/public/browser/browser_thread.h" 68 #include "content/public/browser/browser_thread.h"
70 #include "content/public/browser/devtools_agent_host.h" 69 #include "content/public/browser/devtools_agent_host.h"
71 #include "content/public/browser/notification_service.h" 70 #include "content/public/browser/notification_service.h"
72 #include "content/public/browser/notification_types.h" 71 #include "content/public/browser/notification_types.h"
73 #include "content/public/browser/render_process_host.h" 72 #include "content/public/browser/render_process_host.h"
74 #include "content/public/browser/site_instance.h" 73 #include "content/public/browser/site_instance.h"
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 if (!Manifest::IsUnpackedLocation(extension->location())) { 867 if (!Manifest::IsUnpackedLocation(extension->location())) {
869 if (!GetFileTaskRunner()->PostTask( 868 if (!GetFileTaskRunner()->PostTask(
870 FROM_HERE, 869 FROM_HERE,
871 base::Bind( 870 base::Bind(
872 &extension_file_util::UninstallExtension, 871 &extension_file_util::UninstallExtension,
873 install_directory_, 872 install_directory_,
874 extension_id))) 873 extension_id)))
875 NOTREACHED(); 874 NOTREACHED();
876 } 875 }
877 876
878 GURL launch_web_url_origin( 877 extensions::DataDeleter::StartDeleting(profile_, extension.get());
879 extensions::AppLaunchInfo::GetLaunchWebURL(extension.get()).GetOrigin());
880 bool is_storage_isolated =
881 extensions::AppIsolationInfo::HasIsolatedStorage(extension.get());
882
883 if (is_storage_isolated) {
884 BrowserContext::AsyncObliterateStoragePartition(
885 profile_,
886 GetSiteForExtensionId(extension_id),
887 base::Bind(&ExtensionService::OnNeedsToGarbageCollectIsolatedStorage,
888 AsWeakPtr()));
889 } else {
890 if (extension->is_hosted_app() &&
891 !profile_->GetExtensionSpecialStoragePolicy()->
892 IsStorageProtected(launch_web_url_origin)) {
893 extensions::DataDeleter::StartDeleting(
894 profile_, extension_id, launch_web_url_origin);
895 }
896 extensions::DataDeleter::StartDeleting(profile_, extension_id,
897 extension->url());
898 }
899 878
900 UntrackTerminatedExtension(extension_id); 879 UntrackTerminatedExtension(extension_id);
901 880
902 // Notify interested parties that we've uninstalled this extension. 881 // Notify interested parties that we've uninstalled this extension.
903 content::NotificationService::current()->Notify( 882 content::NotificationService::current()->Notify(
904 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 883 chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
905 content::Source<Profile>(profile_), 884 content::Source<Profile>(profile_),
906 content::Details<const Extension>(extension.get())); 885 content::Details<const Extension>(extension.get()));
907 886
908 if (extension_sync_service_) { 887 if (extension_sync_service_) {
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 ++it) { 2771 ++it) {
2793 to_be_installed.push_back((*it)->id()); 2772 to_be_installed.push_back((*it)->id());
2794 } 2773 }
2795 for (std::vector<std::string>::const_iterator it = to_be_installed.begin(); 2774 for (std::vector<std::string>::const_iterator it = to_be_installed.begin();
2796 it != to_be_installed.end(); 2775 it != to_be_installed.end();
2797 ++it) { 2776 ++it) {
2798 MaybeFinishDelayedInstallation(*it); 2777 MaybeFinishDelayedInstallation(*it);
2799 } 2778 }
2800 } 2779 }
2801 2780
2802 void ExtensionService::OnNeedsToGarbageCollectIsolatedStorage() { 2781 void ExtensionService::OnNeedsToGarbageCollectIsolatedStorage() {
not at google - send to devlin 2014/01/08 02:49:17 move this into DataDeleter. do you still need to
mlamouri (slow - plz ping) 2014/01/08 17:42:31 I would have to get the extension_prefs from the e
not at google - send to devlin 2014/01/08 18:01:36 Yeah I think it would be better to reduce the foot
2803 extension_prefs_->SetNeedsStorageGarbageCollection(true); 2782 extension_prefs_->SetNeedsStorageGarbageCollection(true);
2804 } 2783 }
2805 2784
2806 void ExtensionService::OnBlacklistUpdated() { 2785 void ExtensionService::OnBlacklistUpdated() {
2807 blacklist_->GetMalwareIDs( 2786 blacklist_->GetMalwareIDs(
2808 GenerateInstalledExtensionsSet()->GetIDs(), 2787 GenerateInstalledExtensionsSet()->GetIDs(),
2809 base::Bind(&ExtensionService::ManageBlacklist, AsWeakPtr())); 2788 base::Bind(&ExtensionService::ManageBlacklist, AsWeakPtr()));
2810 } 2789 }
2811 2790
2812 void ExtensionService::ManageBlacklist(const std::set<std::string>& updated) { 2791 void ExtensionService::ManageBlacklist(const std::set<std::string>& updated) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 void ExtensionService::UnloadAllExtensionsInternal() { 2845 void ExtensionService::UnloadAllExtensionsInternal() {
2867 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2846 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2868 2847
2869 registry_->ClearAll(); 2848 registry_->ClearAll();
2870 extension_runtime_data_.clear(); 2849 extension_runtime_data_.clear();
2871 2850
2872 // TODO(erikkay) should there be a notification for this? We can't use 2851 // TODO(erikkay) should there be a notification for this? We can't use
2873 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2852 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2874 // or uninstalled. 2853 // or uninstalled.
2875 } 2854 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698