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

Side by Side Diff: chrome/browser/ui/webui/options/cookies_view_handler.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: Changes based on Albert's review. Created 8 years, 2 months 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/ui/webui/options/cookies_view_handler.h" 5 #include "chrome/browser/ui/webui/options/cookies_view_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "chrome/common/extensions/extension_set.h" 14 #include "chrome/common/extensions/extension_set.h"
15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
17 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" 17 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
18 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 18 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
19 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" 19 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
20 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" 20 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
21 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 21 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
22 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" 22 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h"
23 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" 23 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h"
24 #include "chrome/browser/extensions/extension_service.h" 24 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" 26 #include "chrome/browser/ui/webui/cookies_tree_model_util.h"
27 #include "content/public/browser/browser_context.h" 27 #include "content/public/browser/browser_context.h"
28 #include "content/public/browser/render_process_host.h"
29 #include "content/public/browser/site_instance.h"
28 #include "content/public/browser/storage_partition.h" 30 #include "content/public/browser/storage_partition.h"
29 #include "content/public/browser/web_ui.h" 31 #include "content/public/browser/web_ui.h"
30 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
31 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
32 34
33 namespace fileapi { 35 namespace fileapi {
34 class FileSystemContext; 36 class FileSystemContext;
35 } 37 }
36 38
37 namespace options { 39 namespace options {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 new CookiesTreeModel(apps_map, 218 new CookiesTreeModel(apps_map,
217 profile->GetExtensionSpecialStoragePolicy(), 219 profile->GetExtensionSpecialStoragePolicy(),
218 false)); 220 false));
219 cookies_tree_model_->AddCookiesTreeObserver(this); 221 cookies_tree_model_->AddCookiesTreeObserver(this);
220 } 222 }
221 223
222 if (app_context_ && !app_cookies_tree_model_.get()) { 224 if (app_context_ && !app_cookies_tree_model_.get()) {
223 Profile* profile = Profile::FromWebUI(web_ui()); 225 Profile* profile = Profile::FromWebUI(web_ui());
224 ContainerMap apps_map; 226 ContainerMap apps_map;
225 const ExtensionService* service = profile->GetExtensionService(); 227 const ExtensionService* service = profile->GetExtensionService();
226 if (service) { 228 ExtensionProcessManager* process_manager =
229 profile->GetExtensionProcessManager();
230 if (service && process_manager) {
227 const ExtensionSet* extensions = service->extensions(); 231 const ExtensionSet* extensions = service->extensions();
228 for (ExtensionSet::const_iterator it = extensions->begin(); 232 for (ExtensionSet::const_iterator it = extensions->begin();
229 it != extensions->end(); ++it) { 233 it != extensions->end(); ++it) {
230 if ((*it)->is_storage_isolated()) { 234 if ((*it)->is_storage_isolated()) {
235 content::SiteInstance* site = process_manager->GetSiteInstanceForURL(
236 (*it)->url());
237 content::StoragePartition* storage_partition =
238 site->GetProcess()->GetStoragePartition();
231 net::URLRequestContextGetter* context_getter = 239 net::URLRequestContextGetter* context_getter =
232 profile->GetRequestContextForStoragePartition((*it)->id()); 240 storage_partition->GetURLRequestContext();
233 // TODO(nasko): When new types of storage are isolated, add the 241 // TODO(nasko): When new types of storage are isolated, add the
234 // appropriate browsing data helper objects to the constructor. 242 // appropriate browsing data helper objects to the constructor.
235 // For now, just cookies are isolated, so other parameters are NULL. 243 // For now, just cookies are isolated, so other parameters are NULL.
236 apps_map[(*it)->id()] = new LocalDataContainer( 244 apps_map[(*it)->id()] = new LocalDataContainer(
237 (*it)->name(), (*it)->id(), 245 (*it)->name(), (*it)->id(),
238 new BrowsingDataCookieHelper(context_getter), 246 new BrowsingDataCookieHelper(context_getter),
239 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 247 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
240 } 248 }
241 } 249 }
242 app_cookies_tree_model_.reset( 250 app_cookies_tree_model_.reset(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 std::string CookiesViewHandler::GetCallback( 335 std::string CookiesViewHandler::GetCallback(
328 std::string method, CookiesTreeModel* model) { 336 std::string method, CookiesTreeModel* model) {
329 std::string callback("CookiesView"); 337 std::string callback("CookiesView");
330 338
331 if (model == app_cookies_tree_model_) 339 if (model == app_cookies_tree_model_)
332 callback.append("App"); 340 callback.append("App");
333 return callback.append(".").append(method); 341 return callback.append(".").append(method);
334 } 342 }
335 343
336 } // namespace options 344 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698