| 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..c505c58c06f34b59f68f412f1b153f5bca4ad178 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,46 @@ 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);
|
| +
|
| + 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());
|
| + }
|
|
|
| - StoragePartition* partition =
|
| - BrowserContext::GetStoragePartitionForSite(profile, site);
|
| + // Begin removal of the settings for the current extension.
|
| + profile->GetExtensionService()->settings_frontend()->
|
| + DeleteStorageSoon(extension->id());
|
| +}
|
|
|
| - if (storage_origin.SchemeIs(extensions::kExtensionScheme)) {
|
| +// static
|
| +void DataDeleter::DeleteOrigin(Profile* profile,
|
| + StoragePartition* partition,
|
| + const GURL& origin) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + DCHECK(profile);
|
| + DCHECK(partition);
|
| +
|
| + if (origin.SchemeIs(extensions::kExtensionScheme)) {
|
| // TODO(ajwong): Cookies are not properly isolated for
|
| // chrome-extension:// scheme. (http://crbug.com/158386).
|
| //
|
| @@ -46,7 +78,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 +87,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
|
|
|