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

Side by Side Diff: chrome/browser/ui/views/collected_cookies_views.cc

Issue 10536017: Refactoring CookiesTreeModel to support multiple data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactoring common code and style fixes. Created 8 years, 6 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/views/collected_cookies_views.h" 5 #include "chrome/browser/ui/views/collected_cookies_views.h"
6 6
7 #include "chrome/browser/browsing_data_appcache_helper.h" 7 #include "chrome/browser/browsing_data_appcache_helper.h"
8 #include "chrome/browser/browsing_data_cookie_helper.h" 8 #include "chrome/browser/browsing_data_cookie_helper.h"
9 #include "chrome/browser/browsing_data_database_helper.h" 9 #include "chrome/browser/browsing_data_database_helper.h"
10 #include "chrome/browser/browsing_data_file_system_helper.h" 10 #include "chrome/browser/browsing_data_file_system_helper.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 views::View* CollectedCookiesViews::CreateAllowedPane() { 325 views::View* CollectedCookiesViews::CreateAllowedPane() {
326 TabSpecificContentSettings* content_settings = 326 TabSpecificContentSettings* content_settings =
327 tab_contents_->content_settings(); 327 tab_contents_->content_settings();
328 328
329 // Create the controls that go into the pane. 329 // Create the controls that go into the pane.
330 allowed_label_ = new views::Label(l10n_util::GetStringUTF16( 330 allowed_label_ = new views::Label(l10n_util::GetStringUTF16(
331 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL)); 331 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL));
332 332
333 const LocalSharedObjectsContainer& allowed_lsos = 333 const LocalSharedObjectsContainer& allowed_lsos =
334 content_settings->allowed_local_shared_objects(); 334 content_settings->allowed_local_shared_objects();
335 allowed_cookies_tree_model_.reset( 335
336 new CookiesTreeModel(allowed_lsos.cookies()->Clone(), 336 string16 name = ASCIIToUTF16("Site Data");
337 allowed_lsos.databases()->Clone(), 337 string16 browser_id;
338 allowed_lsos.local_storages()->Clone(), 338 ContainerMap apps_map;
339 allowed_lsos.session_storages()->Clone(), 339 apps_map[browser_id] = new LocalDataContainer(
340 allowed_lsos.appcaches()->Clone(), 340 name, browser_id,
341 allowed_lsos.indexed_dbs()->Clone(), 341 allowed_lsos.cookies()->Clone(),
342 allowed_lsos.file_systems()->Clone(), 342 allowed_lsos.databases()->Clone(),
343 NULL, 343 allowed_lsos.local_storages()->Clone(),
344 allowed_lsos.server_bound_certs()->Clone(), 344 allowed_lsos.session_storages()->Clone(),
345 true)); 345 allowed_lsos.appcaches()->Clone(),
346 allowed_lsos.indexed_dbs()->Clone(),
347 allowed_lsos.file_systems()->Clone(),
348 NULL,
349 allowed_lsos.server_bound_certs()->Clone());
350
351 allowed_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, true));
346 allowed_cookies_tree_ = new views::TreeView(); 352 allowed_cookies_tree_ = new views::TreeView();
347 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get()); 353 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get());
348 allowed_cookies_tree_->SetRootShown(false); 354 allowed_cookies_tree_->SetRootShown(false);
349 allowed_cookies_tree_->SetEditable(false); 355 allowed_cookies_tree_->SetEditable(false);
350 allowed_cookies_tree_->set_lines_at_root(true); 356 allowed_cookies_tree_->set_lines_at_root(true);
351 allowed_cookies_tree_->set_auto_expand_children(true); 357 allowed_cookies_tree_->set_auto_expand_children(true);
352 allowed_cookies_tree_->SetController(this); 358 allowed_cookies_tree_->SetController(this);
353 359
354 block_allowed_button_ = new views::NativeTextButton(this, 360 block_allowed_button_ = new views::NativeTextButton(this,
355 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)); 361 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 // Create the controls that go into the pane. 399 // Create the controls that go into the pane.
394 blocked_label_ = new views::Label( 400 blocked_label_ = new views::Label(
395 l10n_util::GetStringUTF16( 401 l10n_util::GetStringUTF16(
396 prefs->GetBoolean(prefs::kBlockThirdPartyCookies) ? 402 prefs->GetBoolean(prefs::kBlockThirdPartyCookies) ?
397 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : 403 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED :
398 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL)); 404 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL));
399 blocked_label_->SetMultiLine(true); 405 blocked_label_->SetMultiLine(true);
400 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 406 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
401 const LocalSharedObjectsContainer& blocked_lsos = 407 const LocalSharedObjectsContainer& blocked_lsos =
402 content_settings->blocked_local_shared_objects(); 408 content_settings->blocked_local_shared_objects();
403 blocked_cookies_tree_model_.reset( 409
404 new CookiesTreeModel(blocked_lsos.cookies()->Clone(), 410 string16 name = ASCIIToUTF16("Site Data");
405 blocked_lsos.databases()->Clone(), 411 string16 browser_id;
406 blocked_lsos.local_storages()->Clone(), 412 ContainerMap apps_map;
407 blocked_lsos.session_storages()->Clone(), 413 apps_map[browser_id] = new LocalDataContainer(
408 blocked_lsos.appcaches()->Clone(), 414 name, browser_id,
409 blocked_lsos.indexed_dbs()->Clone(), 415 blocked_lsos.cookies()->Clone(),
410 blocked_lsos.file_systems()->Clone(), 416 blocked_lsos.databases()->Clone(),
411 NULL, 417 blocked_lsos.local_storages()->Clone(),
412 blocked_lsos.server_bound_certs()->Clone(), 418 blocked_lsos.session_storages()->Clone(),
413 true)); 419 blocked_lsos.appcaches()->Clone(),
420 blocked_lsos.indexed_dbs()->Clone(),
421 blocked_lsos.file_systems()->Clone(),
422 NULL,
423 blocked_lsos.server_bound_certs()->Clone());
424
425 blocked_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, true));
414 blocked_cookies_tree_ = new views::TreeView(); 426 blocked_cookies_tree_ = new views::TreeView();
415 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); 427 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get());
416 blocked_cookies_tree_->SetRootShown(false); 428 blocked_cookies_tree_->SetRootShown(false);
417 blocked_cookies_tree_->SetEditable(false); 429 blocked_cookies_tree_->SetEditable(false);
418 blocked_cookies_tree_->set_lines_at_root(true); 430 blocked_cookies_tree_->set_lines_at_root(true);
419 blocked_cookies_tree_->set_auto_expand_children(true); 431 blocked_cookies_tree_->set_auto_expand_children(true);
420 blocked_cookies_tree_->SetController(this); 432 blocked_cookies_tree_->SetController(this);
421 433
422 allow_blocked_button_ = new views::NativeTextButton(this, 434 allow_blocked_button_ = new views::NativeTextButton(this,
423 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)); 435 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 /////////////////////////////////////////////////////////////////////////////// 536 ///////////////////////////////////////////////////////////////////////////////
525 // CollectedCookiesViews, content::NotificationObserver implementation: 537 // CollectedCookiesViews, content::NotificationObserver implementation:
526 538
527 void CollectedCookiesViews::Observe( 539 void CollectedCookiesViews::Observe(
528 int type, 540 int type,
529 const content::NotificationSource& source, 541 const content::NotificationSource& source,
530 const content::NotificationDetails& details) { 542 const content::NotificationDetails& details) {
531 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); 543 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN);
532 window_->CloseConstrainedWindow(); 544 window_->CloseConstrainedWindow();
533 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698