diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-17 12:20:10 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-17 12:20:10 +0000 |
commit | 14acc6453fa956c279b2b788e00f937e23d951b3 (patch) | |
tree | 04df34881382e794d7218af42a62aa43df57e5e2 /content/browser/browser_context.cc | |
parent | 3df6cdbbdec79e947aeadfbb360c755b7790a637 (diff) | |
download | chromium_src-14acc6453fa956c279b2b788e00f937e23d951b3.zip chromium_src-14acc6453fa956c279b2b788e00f937e23d951b3.tar.gz chromium_src-14acc6453fa956c279b2b788e00f937e23d951b3.tar.bz2 |
Implement the ability to obliterate a storage partition from disk.
On the uninstall of an extension with isolated storage, we want to delete
all the data for the extension from disk as soon as possible. Because we
cannot know when various objects with state on disk
(eg., FileSystemContext) have all been deleted, we do a best-effort delete
for any directory that we know isn't being used.
The way this gets projected into the content modulue is that each extension
defines one partition_domain. If an extension has a <webview> tag, it will
also have multiple StoragePartitions, each with a different partition_name.
If it doesn't have a <webview> tag, the partition_name is considered empty
which yields the default partition. The default partition, and all webview
partitions are peers inside the partition_domain's root directory.
This CL introduces a function that allows us to delete partiton domain.
Special care is taken to not accidentally instantiate a StoragePartition for
the domain if none current exists. This is necessary to allow us to actually
delete the whole partition domain directory.
(Patch by ajwong@chromium.org)
BUG=85127
Review URL: https://chromiumcodereview.appspot.com/11280030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_context.cc')
-rw-r--r-- | content/browser/browser_context.cc | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index d8bc87e..79355bc 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc @@ -37,11 +37,8 @@ namespace { const char* kDownloadManagerKeyName = "download_manager"; const char* kStorageParitionMapKeyName = "content_storage_partition_map"; -StoragePartition* GetStoragePartitionFromConfig( - BrowserContext* browser_context, - const std::string& partition_domain, - const std::string& partition_name, - bool in_memory) { +StoragePartitionImplMap* GetStoragePartitionMap( + BrowserContext* browser_context) { StoragePartitionImplMap* partition_map = static_cast<StoragePartitionImplMap*>( browser_context->GetUserData(kStorageParitionMapKeyName)); @@ -49,6 +46,16 @@ StoragePartition* GetStoragePartitionFromConfig( partition_map = new StoragePartitionImplMap(browser_context); browser_context->SetUserData(kStorageParitionMapKeyName, partition_map); } + return partition_map; +} + +StoragePartition* GetStoragePartitionFromConfig( + BrowserContext* browser_context, + const std::string& partition_domain, + const std::string& partition_name, + bool in_memory) { + StoragePartitionImplMap* partition_map = + GetStoragePartitionMap(browser_context); if (browser_context->IsOffTheRecord()) in_memory = true; @@ -84,6 +91,13 @@ void PurgeMemoryOnIOThread(appcache::AppCacheService* appcache_service) { } // namespace +// static +void BrowserContext::AsyncObliterateStoragePartition( + BrowserContext* browser_context, + const GURL& site) { + GetStoragePartitionMap(browser_context)->AsyncObliterate(site); +} + DownloadManager* BrowserContext::GetDownloadManager( BrowserContext* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -116,7 +130,7 @@ StoragePartition* BrowserContext::GetStoragePartition( // this conditional and require that |site_instance| is non-NULL. if (site_instance) { GetContentClient()->browser()->GetStoragePartitionConfigForSite( - browser_context, site_instance->GetSiteURL(), + browser_context, site_instance->GetSiteURL(), true, &partition_domain, &partition_name, &in_memory); } @@ -132,7 +146,8 @@ StoragePartition* BrowserContext::GetStoragePartitionForSite( bool in_memory; GetContentClient()->browser()->GetStoragePartitionConfigForSite( - browser_context, site, &partition_domain, &partition_name, &in_memory); + browser_context, site, true, &partition_domain, &partition_name, + &in_memory); return GetStoragePartitionFromConfig( browser_context, partition_domain, partition_name, in_memory); |