Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/browser/extensions/data_deleter.cc

Issue 11147026: Initial refactor to get profiles to propagate storage partition details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missed a merging of removed variable. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 const GURL& url = Extension::GetBaseURLFromExtensionId(extension_id);
96 profile->GetRequestContextForStoragePartition(extension_id); 98 content::StoragePartition* storage_partition =
97 isolated_app_path_ = 99 BrowserContext::GetStoragePartitionForSite(profile, url);
98 profile->GetPath().Append( 100 // TODO(ajwong): Cookies are not properly isolated for
99 content::StoragePartition::GetPartitionPath(extension_id)); 101 // chrome-extension:// scheme. See bug http://crbug.com/158386.
102 extension_request_context_ = storage_partition->GetURLRequestContext();
103 isolated_app_path_ = storage_partition->GetPath();
100 } else { 104 } else {
101 extension_request_context_ = profile->GetRequestContext(); 105 extension_request_context_ = profile->GetRequestContext();
102 } 106 }
103 file_system_context_ = storage_partition->GetFileSystemContext(); 107 file_system_context_ = storage_partition->GetFileSystemContext();
104 indexed_db_context_ = storage_partition->GetIndexedDBContext(); 108 indexed_db_context_ = storage_partition->GetIndexedDBContext();
105 109
106 storage_origin_ = storage_origin; 110 storage_origin_ = storage_origin;
107 origin_id_ = 111 origin_id_ =
108 webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin_); 112 webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin_);
109 } 113 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 149 }
146 150
147 void DataDeleter::DeleteAppcachesOnIOThread( 151 void DataDeleter::DeleteAppcachesOnIOThread(
148 appcache::AppCacheService* appcache_service) { 152 appcache::AppCacheService* appcache_service) {
149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
150 appcache_service->DeleteAppCachesForOrigin(storage_origin_, 154 appcache_service->DeleteAppCachesForOrigin(storage_origin_,
151 net::CompletionCallback()); 155 net::CompletionCallback());
152 } 156 }
153 157
154 } // namespace extensions 158 } // namespace extensions
OLDNEW
« no previous file with comments | « android_webview/browser/aw_browser_context.cc ('k') | chrome/browser/extensions/web_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698