Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/data_deleter.h" | 5 #include "chrome/browser/extensions/data_deleter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/settings/settings_frontend.h" | 10 #include "chrome/browser/extensions/settings/settings_frontend.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
| 13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "content/public/browser/dom_storage_context.h" | 15 #include "content/public/browser/dom_storage_context.h" |
| 16 #include "content/public/browser/indexed_db_context.h" | 16 #include "content/public/browser/indexed_db_context.h" |
| 17 #include "content/public/browser/render_process_host.h" | |
| 18 #include "content/public/browser/site_instance.h" | |
| 17 #include "content/public/browser/storage_partition.h" | 19 #include "content/public/browser/storage_partition.h" |
| 18 #include "content/public/common/content_constants.h" | 20 #include "content/public/common/content_constants.h" |
| 19 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
| 20 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 21 #include "net/cookies/cookie_monster.h" | 23 #include "net/cookies/cookie_monster.h" |
| 22 #include "net/url_request/url_request_context.h" | 24 #include "net/url_request/url_request_context.h" |
| 23 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
| 24 #include "webkit/appcache/appcache_service.h" | 26 #include "webkit/appcache/appcache_service.h" |
| 25 #include "webkit/database/database_tracker.h" | 27 #include "webkit/database/database_tracker.h" |
| 26 #include "webkit/database/database_util.h" | 28 #include "webkit/database/database_util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 // http://crbug.com/85127 | 87 // http://crbug.com/85127 |
| 86 database_tracker_ = BrowserContext::GetDefaultStoragePartition(profile)-> | 88 database_tracker_ = BrowserContext::GetDefaultStoragePartition(profile)-> |
| 87 GetDatabaseTracker(); | 89 GetDatabaseTracker(); |
| 88 // Pick the right request context depending on whether it's an extension, | 90 // Pick the right request context depending on whether it's an extension, |
| 89 // isolated app, or regular app. | 91 // isolated app, or regular app. |
| 90 content::StoragePartition* storage_partition = | 92 content::StoragePartition* storage_partition = |
| 91 BrowserContext::GetDefaultStoragePartition(profile); | 93 BrowserContext::GetDefaultStoragePartition(profile); |
| 92 if (storage_origin.SchemeIs(chrome::kExtensionScheme)) { | 94 if (storage_origin.SchemeIs(chrome::kExtensionScheme)) { |
| 93 extension_request_context_ = profile->GetRequestContextForExtensions(); | 95 extension_request_context_ = profile->GetRequestContextForExtensions(); |
| 94 } else if (is_storage_isolated) { | 96 } else if (is_storage_isolated) { |
| 95 extension_request_context_ = | 97 GURL url = Extension::GetBaseURLFromExtensionId(extension_id); |
| 96 profile->GetRequestContextForStoragePartition(extension_id); | 98 ExtensionProcessManager* process_manager = |
| 97 isolated_app_path_ = | 99 profile->GetExtensionProcessManager(); |
| 98 profile->GetPath().Append( | 100 if (process_manager) { |
| 99 content::StoragePartition::GetPartitionPath(extension_id)); | 101 content::SiteInstance* site = process_manager->GetSiteInstanceForURL(url); |
| 102 content::StoragePartition* storage_partition = | |
| 103 site->GetProcess()->GetStoragePartition(); | |
| 104 extension_request_context_ = | |
| 105 profile->GetRequestContextForStoragePartition( | |
|
awong
2012/10/18 22:36:15
Why isn't this just the RequestContext() out of st
nasko
2012/10/19 17:29:14
Done.
| |
| 106 storage_partition->GetPath(), | |
| 107 storage_partition->IsInMemoryOnly()); | |
| 108 isolated_app_path_ = storage_partition->GetPath(); | |
| 109 } | |
| 100 } else { | 110 } else { |
| 101 extension_request_context_ = profile->GetRequestContext(); | 111 extension_request_context_ = profile->GetRequestContext(); |
| 102 } | 112 } |
| 103 file_system_context_ = storage_partition->GetFileSystemContext(); | 113 file_system_context_ = storage_partition->GetFileSystemContext(); |
| 104 indexed_db_context_ = storage_partition->GetIndexedDBContext(); | 114 indexed_db_context_ = storage_partition->GetIndexedDBContext(); |
| 105 | 115 |
| 106 storage_origin_ = storage_origin; | 116 storage_origin_ = storage_origin; |
| 107 origin_id_ = | 117 origin_id_ = |
| 108 webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin_); | 118 webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin_); |
| 109 } | 119 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 } | 155 } |
| 146 | 156 |
| 147 void DataDeleter::DeleteAppcachesOnIOThread( | 157 void DataDeleter::DeleteAppcachesOnIOThread( |
| 148 appcache::AppCacheService* appcache_service) { | 158 appcache::AppCacheService* appcache_service) { |
| 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 150 appcache_service->DeleteAppCachesForOrigin(storage_origin_, | 160 appcache_service->DeleteAppCachesForOrigin(storage_origin_, |
| 151 net::CompletionCallback()); | 161 net::CompletionCallback()); |
| 152 } | 162 } |
| 153 | 163 |
| 154 } // namespace extensions | 164 } // namespace extensions |
| OLD | NEW |