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

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: Fixing Android's BrowserContext. 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/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/extensions/extension_system.h"
25 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" 27 #include "chrome/browser/ui/webui/cookies_tree_model_util.h"
27 #include "content/public/browser/browser_context.h" 28 #include "content/public/browser/browser_context.h"
29 #include "content/public/browser/render_process_host.h"
30 #include "content/public/browser/site_instance.h"
28 #include "content/public/browser/storage_partition.h" 31 #include "content/public/browser/storage_partition.h"
29 #include "content/public/browser/web_ui.h" 32 #include "content/public/browser/web_ui.h"
30 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
31 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
32 35
33 namespace fileapi { 36 namespace fileapi {
34 class FileSystemContext; 37 class FileSystemContext;
35 } 38 }
36 39
37 namespace options { 40 namespace options {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 new CookiesTreeModel(apps_map, 219 new CookiesTreeModel(apps_map,
217 profile->GetExtensionSpecialStoragePolicy(), 220 profile->GetExtensionSpecialStoragePolicy(),
218 false)); 221 false));
219 cookies_tree_model_->AddCookiesTreeObserver(this); 222 cookies_tree_model_->AddCookiesTreeObserver(this);
220 } 223 }
221 224
222 if (app_context_ && !app_cookies_tree_model_.get()) { 225 if (app_context_ && !app_cookies_tree_model_.get()) {
223 Profile* profile = Profile::FromWebUI(web_ui()); 226 Profile* profile = Profile::FromWebUI(web_ui());
224 ContainerMap apps_map; 227 ContainerMap apps_map;
225 const ExtensionService* service = profile->GetExtensionService(); 228 const ExtensionService* service = profile->GetExtensionService();
226 if (service) { 229 ExtensionProcessManager* process_manager =
230 extensions::ExtensionSystem::Get(profile)->process_manager();
231 if (service && process_manager) {
James Hawkins 2012/10/30 17:40:53 Save indentation and processing by returning early
nasko 2012/10/30 19:55:25 Done.
227 const ExtensionSet* extensions = service->extensions(); 232 const ExtensionSet* extensions = service->extensions();
228 for (ExtensionSet::const_iterator it = extensions->begin(); 233 for (ExtensionSet::const_iterator it = extensions->begin();
229 it != extensions->end(); ++it) { 234 it != extensions->end(); ++it) {
230 if ((*it)->is_storage_isolated()) { 235 if ((*it)->is_storage_isolated()) {
236 content::StoragePartition* storage_partition =
237 content::BrowserContext::GetStoragePartitionForSite(profile,
238 (*it)->url());
231 net::URLRequestContextGetter* context_getter = 239 net::URLRequestContextGetter* context_getter =
232 profile->GetRequestContextForStoragePartition((*it)->id()); 240 storage_partition->GetURLRequestContext();
Charlie Reis 2012/10/30 17:47:48 nit: 2 more spaces
nasko 2012/10/30 19:55:25 Done.
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.
Charlie Reis 2012/10/30 17:47:48 Nasko, is this still true? We do isolate other ty
nasko 2012/10/30 19:55:25 Based on our discussion from yesterday, since isol
Charlie Reis 2012/10/30 20:13:07 Ok.
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(
243 new CookiesTreeModel(apps_map, 251 new CookiesTreeModel(apps_map,
244 profile->GetExtensionSpecialStoragePolicy(), 252 profile->GetExtensionSpecialStoragePolicy(),
245 false)); 253 false));
(...skipping 81 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