| 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/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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 views::View* CollectedCookiesViews::CreateAllowedPane() { | 324 views::View* CollectedCookiesViews::CreateAllowedPane() { |
| 325 TabSpecificContentSettings* content_settings = | 325 TabSpecificContentSettings* content_settings = |
| 326 tab_contents_->content_settings(); | 326 tab_contents_->content_settings(); |
| 327 | 327 |
| 328 // Create the controls that go into the pane. | 328 // Create the controls that go into the pane. |
| 329 allowed_label_ = new views::Label(l10n_util::GetStringUTF16( | 329 allowed_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 330 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL)); | 330 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL)); |
| 331 | 331 |
| 332 const LocalSharedObjectsContainer& allowed_lsos = | 332 const LocalSharedObjectsContainer& allowed_lsos = |
| 333 content_settings->allowed_local_shared_objects(); | 333 content_settings->allowed_local_shared_objects(); |
| 334 allowed_cookies_tree_model_.reset( | 334 ContainerMap apps_map; |
| 335 new CookiesTreeModel(allowed_lsos.cookies()->Clone(), | 335 apps_map[std::string()] = new LocalDataContainer( |
| 336 allowed_lsos.databases()->Clone(), | 336 std::string(), std::string(), |
| 337 allowed_lsos.local_storages()->Clone(), | 337 allowed_lsos.cookies()->Clone(), |
| 338 allowed_lsos.session_storages()->Clone(), | 338 allowed_lsos.databases()->Clone(), |
| 339 allowed_lsos.appcaches()->Clone(), | 339 allowed_lsos.local_storages()->Clone(), |
| 340 allowed_lsos.indexed_dbs()->Clone(), | 340 allowed_lsos.session_storages()->Clone(), |
| 341 allowed_lsos.file_systems()->Clone(), | 341 allowed_lsos.appcaches()->Clone(), |
| 342 NULL, | 342 allowed_lsos.indexed_dbs()->Clone(), |
| 343 allowed_lsos.server_bound_certs()->Clone(), | 343 allowed_lsos.file_systems()->Clone(), |
| 344 true)); | 344 NULL, |
| 345 allowed_lsos.server_bound_certs()->Clone()); |
| 346 |
| 347 allowed_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, true)); |
| 345 allowed_cookies_tree_ = new views::TreeView(); | 348 allowed_cookies_tree_ = new views::TreeView(); |
| 346 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get()); | 349 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get()); |
| 347 allowed_cookies_tree_->SetRootShown(false); | 350 allowed_cookies_tree_->SetRootShown(false); |
| 348 allowed_cookies_tree_->SetEditable(false); | 351 allowed_cookies_tree_->SetEditable(false); |
| 349 allowed_cookies_tree_->set_lines_at_root(true); | 352 allowed_cookies_tree_->set_lines_at_root(true); |
| 350 allowed_cookies_tree_->set_auto_expand_children(true); | 353 allowed_cookies_tree_->set_auto_expand_children(true); |
| 351 allowed_cookies_tree_->SetController(this); | 354 allowed_cookies_tree_->SetController(this); |
| 352 | 355 |
| 353 block_allowed_button_ = new views::NativeTextButton(this, | 356 block_allowed_button_ = new views::NativeTextButton(this, |
| 354 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)); | 357 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // Create the controls that go into the pane. | 395 // Create the controls that go into the pane. |
| 393 blocked_label_ = new views::Label( | 396 blocked_label_ = new views::Label( |
| 394 l10n_util::GetStringUTF16( | 397 l10n_util::GetStringUTF16( |
| 395 prefs->GetBoolean(prefs::kBlockThirdPartyCookies) ? | 398 prefs->GetBoolean(prefs::kBlockThirdPartyCookies) ? |
| 396 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : | 399 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : |
| 397 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL)); | 400 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL)); |
| 398 blocked_label_->SetMultiLine(true); | 401 blocked_label_->SetMultiLine(true); |
| 399 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 402 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 400 const LocalSharedObjectsContainer& blocked_lsos = | 403 const LocalSharedObjectsContainer& blocked_lsos = |
| 401 content_settings->blocked_local_shared_objects(); | 404 content_settings->blocked_local_shared_objects(); |
| 402 blocked_cookies_tree_model_.reset( | 405 string16 name = ASCIIToUTF16("Site Data"); |
| 403 new CookiesTreeModel(blocked_lsos.cookies()->Clone(), | 406 ContainerMap apps_map; |
| 404 blocked_lsos.databases()->Clone(), | 407 apps_map[std::string()] = new LocalDataContainer( |
| 405 blocked_lsos.local_storages()->Clone(), | 408 std::string(), std::string(), |
| 406 blocked_lsos.session_storages()->Clone(), | 409 blocked_lsos.cookies()->Clone(), |
| 407 blocked_lsos.appcaches()->Clone(), | 410 blocked_lsos.databases()->Clone(), |
| 408 blocked_lsos.indexed_dbs()->Clone(), | 411 blocked_lsos.local_storages()->Clone(), |
| 409 blocked_lsos.file_systems()->Clone(), | 412 blocked_lsos.session_storages()->Clone(), |
| 410 NULL, | 413 blocked_lsos.appcaches()->Clone(), |
| 411 blocked_lsos.server_bound_certs()->Clone(), | 414 blocked_lsos.indexed_dbs()->Clone(), |
| 412 true)); | 415 blocked_lsos.file_systems()->Clone(), |
| 416 NULL, |
| 417 blocked_lsos.server_bound_certs()->Clone()); |
| 418 |
| 419 blocked_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, true)); |
| 413 blocked_cookies_tree_ = new views::TreeView(); | 420 blocked_cookies_tree_ = new views::TreeView(); |
| 414 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); | 421 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); |
| 415 blocked_cookies_tree_->SetRootShown(false); | 422 blocked_cookies_tree_->SetRootShown(false); |
| 416 blocked_cookies_tree_->SetEditable(false); | 423 blocked_cookies_tree_->SetEditable(false); |
| 417 blocked_cookies_tree_->set_lines_at_root(true); | 424 blocked_cookies_tree_->set_lines_at_root(true); |
| 418 blocked_cookies_tree_->set_auto_expand_children(true); | 425 blocked_cookies_tree_->set_auto_expand_children(true); |
| 419 blocked_cookies_tree_->SetController(this); | 426 blocked_cookies_tree_->SetController(this); |
| 420 | 427 |
| 421 allow_blocked_button_ = new views::NativeTextButton(this, | 428 allow_blocked_button_ = new views::NativeTextButton(this, |
| 422 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)); | 429 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 /////////////////////////////////////////////////////////////////////////////// | 530 /////////////////////////////////////////////////////////////////////////////// |
| 524 // CollectedCookiesViews, content::NotificationObserver implementation: | 531 // CollectedCookiesViews, content::NotificationObserver implementation: |
| 525 | 532 |
| 526 void CollectedCookiesViews::Observe( | 533 void CollectedCookiesViews::Observe( |
| 527 int type, | 534 int type, |
| 528 const content::NotificationSource& source, | 535 const content::NotificationSource& source, |
| 529 const content::NotificationDetails& details) { | 536 const content::NotificationDetails& details) { |
| 530 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); | 537 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); |
| 531 window_->CloseConstrainedWindow(); | 538 window_->CloseConstrainedWindow(); |
| 532 } | 539 } |
| OLD | NEW |