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); |
|
awong
2012/10/19 23:26:50
variable should be site_instance.
Or if BaseURL i
nasko
2012/10/19 23:55:16
Done.
| |
| 102 content::StoragePartition* storage_partition = | |
| 103 site->GetProcess()->GetStoragePartition(); | |
| 104 extension_request_context_ = storage_partition->GetURLRequestContext(); | |
| 105 isolated_app_path_ = storage_partition->GetPath(); | |
| 106 } | |
| 100 } else { | 107 } else { |
| 101 extension_request_context_ = profile->GetRequestContext(); | 108 extension_request_context_ = profile->GetRequestContext(); |
| 102 } | 109 } |
| 103 file_system_context_ = storage_partition->GetFileSystemContext(); | 110 file_system_context_ = storage_partition->GetFileSystemContext(); |
| 104 indexed_db_context_ = storage_partition->GetIndexedDBContext(); | 111 indexed_db_context_ = storage_partition->GetIndexedDBContext(); |
| 105 | 112 |
| 106 storage_origin_ = storage_origin; | 113 storage_origin_ = storage_origin; |
| 107 origin_id_ = | 114 origin_id_ = |
| 108 webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin_); | 115 webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin_); |
| 109 } | 116 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 } | 152 } |
| 146 | 153 |
| 147 void DataDeleter::DeleteAppcachesOnIOThread( | 154 void DataDeleter::DeleteAppcachesOnIOThread( |
| 148 appcache::AppCacheService* appcache_service) { | 155 appcache::AppCacheService* appcache_service) { |
| 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 150 appcache_service->DeleteAppCachesForOrigin(storage_origin_, | 157 appcache_service->DeleteAppCachesForOrigin(storage_origin_, |
| 151 net::CompletionCallback()); | 158 net::CompletionCallback()); |
| 152 } | 159 } |
| 153 | 160 |
| 154 } // namespace extensions | 161 } // namespace extensions |
| OLD | NEW |