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

Unified Diff: chrome/browser/extensions/data_deleter.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/data_deleter.cc
diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc
index c0947f8722e6083ae1aef26b3c8a9b4183072433..d378d6510ca516abfe33332422b647f8d5b4a20e 100644
--- a/chrome/browser/extensions/data_deleter.cc
+++ b/chrome/browser/extensions/data_deleter.cc
@@ -6,9 +6,13 @@
#include "chrome/browser/extensions/api/storage/settings_frontend.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
+#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
@@ -21,9 +25,39 @@ using content::StoragePartition;
namespace extensions {
// static
-void DataDeleter::StartDeleting(Profile* profile,
- const std::string& extension_id,
- const GURL& storage_origin) {
+void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) {
+ DCHECK(profile);
+ DCHECK(extension);
+
+ std::string extension_id = extension->id();
+
+ if (extensions::AppIsolationInfo::HasIsolatedStorage(extension)) {
+ BrowserContext::AsyncObliterateStoragePartition(
+ profile,
+ profile->GetExtensionService()->GetSiteForExtensionId(extension_id),
+ base::Bind(&ExtensionService::OnNeedsToGarbageCollectIsolatedStorage,
+ profile->GetExtensionService()->AsWeakPtr()));
+ } else {
+ GURL launch_web_url_origin(
+ extensions::AppLaunchInfo::GetLaunchWebURL(extension).GetOrigin());
+
+ if (extension->is_hosted_app() &&
+ !profile->GetExtensionSpecialStoragePolicy()->
+ IsStorageProtected(launch_web_url_origin)) {
+ DeleteNonIsolatedStorage(profile, extension_id, launch_web_url_origin);
not at google - send to devlin 2014/01/08 02:49:17 interesting that we do this
+ }
+ DeleteNonIsolatedStorage(profile, extension_id, extension->url());
+ }
+
+ // Begin removal of the settings for the current extension.
+ profile->GetExtensionService()->settings_frontend()->
+ DeleteStorageSoon(extension_id);
+}
+
+// static
+void DataDeleter::DeleteNonIsolatedStorage(Profile* profile,
not at google - send to devlin 2014/01/08 02:49:17 nit: name is a bit misleading. this deletes the st
mlamouri (slow - plz ping) 2014/01/08 17:42:31 Done.
+ const std::string& extension_id,
+ const GURL& storage_origin) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(profile);
@@ -58,10 +92,6 @@ void DataDeleter::StartDeleting(Profile* profile,
storage_origin,
partition->GetURLRequestContext());
}
-
- // Begin removal of the settings for the current extension.
- profile->GetExtensionService()->settings_frontend()->
- DeleteStorageSoon(extension_id);
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698