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..97f54cc29f4b3b1ccf121e5ea4d02b38a10e2d51 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,18 +25,48 @@ using content::StoragePartition; |
namespace extensions { |
// static |
-void DataDeleter::StartDeleting(Profile* profile, |
- const std::string& extension_id, |
- const GURL& storage_origin) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) { |
DCHECK(profile); |
+ DCHECK(extension); |
+ |
+ std::string extension_id = extension->id(); |
not at google - send to devlin
2014/01/08 18:01:36
should be a const std::string&, however, IMO this
mlamouri (slow - plz ping)
2014/01/08 23:44:08
Agreed. It's not that needed. That code changed a
|
+ |
+ 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()); |
+ |
+ StoragePartition* partition = BrowserContext::GetStoragePartitionForSite( |
+ profile, |
+ Extension::GetBaseURLFromExtensionId(extension_id)); |
- const GURL& site = Extension::GetBaseURLFromExtensionId(extension_id); |
+ if (extension->is_hosted_app() && |
+ !profile->GetExtensionSpecialStoragePolicy()-> |
+ IsStorageProtected(launch_web_url_origin)) { |
+ DeleteOrigin(profile, partition, launch_web_url_origin); |
+ } |
+ DeleteOrigin(profile, partition, extension->url()); |
+ } |
+ |
+ // Begin removal of the settings for the current extension. |
+ profile->GetExtensionService()->settings_frontend()-> |
+ DeleteStorageSoon(extension_id); |
+} |
- StoragePartition* partition = |
- BrowserContext::GetStoragePartitionForSite(profile, site); |
+// static |
+void DataDeleter::DeleteOrigin(Profile* profile, |
+ StoragePartition* partition, |
+ const GURL& origin) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(profile); |
+ DCHECK(partition); |
- if (storage_origin.SchemeIs(extensions::kExtensionScheme)) { |
+ if (origin.SchemeIs(extensions::kExtensionScheme)) { |
// TODO(ajwong): Cookies are not properly isolated for |
// chrome-extension:// scheme. (http://crbug.com/158386). |
// |
@@ -46,7 +80,7 @@ void DataDeleter::StartDeleting(Profile* profile, |
StoragePartition::REMOVE_DATA_MASK_ALL & |
(~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE), |
StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
- storage_origin, |
+ origin, |
profile->GetRequestContextForExtensions()); |
} else { |
// We don't need to worry about the media request context because that |
@@ -55,13 +89,9 @@ void DataDeleter::StartDeleting(Profile* profile, |
StoragePartition::REMOVE_DATA_MASK_ALL & |
(~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE), |
StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
- storage_origin, |
+ origin, |
partition->GetURLRequestContext()); |
} |
- |
- // Begin removal of the settings for the current extension. |
- profile->GetExtensionService()->settings_frontend()-> |
- DeleteStorageSoon(extension_id); |
} |
} // namespace extensions |