| 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/browsing_data_appcache_helper.h" | 7 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 8 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 8 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 334 } |
| 335 | 335 |
| 336 views::View* CollectedCookiesViews::CreateAllowedPane() { | 336 views::View* CollectedCookiesViews::CreateAllowedPane() { |
| 337 TabSpecificContentSettings* content_settings = | 337 TabSpecificContentSettings* content_settings = |
| 338 tab_contents_->content_settings(); | 338 tab_contents_->content_settings(); |
| 339 | 339 |
| 340 // Create the controls that go into the pane. | 340 // Create the controls that go into the pane. |
| 341 allowed_label_ = new views::Label(l10n_util::GetStringUTF16( | 341 allowed_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 342 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL)); | 342 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL)); |
| 343 | 343 |
| 344 const LocalSharedObjectsContainer& allowed_lsos = | 344 const LocalSharedObjectsContainer& allowed_data = |
| 345 content_settings->allowed_local_shared_objects(); | 345 content_settings->allowed_local_shared_objects(); |
| 346 ContainerMap apps_map; | 346 allowed_cookies_tree_model_ = allowed_data.CreateCookiesTreeModel(); |
| 347 apps_map[std::string()] = new LocalDataContainer( | |
| 348 std::string(), std::string(), | |
| 349 allowed_lsos.cookies()->Clone(), | |
| 350 allowed_lsos.databases()->Clone(), | |
| 351 allowed_lsos.local_storages()->Clone(), | |
| 352 allowed_lsos.session_storages()->Clone(), | |
| 353 allowed_lsos.appcaches()->Clone(), | |
| 354 allowed_lsos.indexed_dbs()->Clone(), | |
| 355 allowed_lsos.file_systems()->Clone(), | |
| 356 NULL, | |
| 357 allowed_lsos.server_bound_certs()->Clone()); | |
| 358 | |
| 359 allowed_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, NULL, true)); | |
| 360 allowed_cookies_tree_ = new views::TreeView(); | 347 allowed_cookies_tree_ = new views::TreeView(); |
| 361 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get()); | 348 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get()); |
| 362 allowed_cookies_tree_->SetRootShown(false); | 349 allowed_cookies_tree_->SetRootShown(false); |
| 363 allowed_cookies_tree_->SetEditable(false); | 350 allowed_cookies_tree_->SetEditable(false); |
| 364 allowed_cookies_tree_->set_lines_at_root(true); | 351 allowed_cookies_tree_->set_lines_at_root(true); |
| 365 allowed_cookies_tree_->set_auto_expand_children(true); | 352 allowed_cookies_tree_->set_auto_expand_children(true); |
| 366 allowed_cookies_tree_->SetController(this); | 353 allowed_cookies_tree_->SetController(this); |
| 367 | 354 |
| 368 block_allowed_button_ = new views::NativeTextButton(this, | 355 block_allowed_button_ = new views::NativeTextButton(this, |
| 369 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)); | 356 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 PrefService* prefs = tab_contents_->profile()->GetPrefs(); | 392 PrefService* prefs = tab_contents_->profile()->GetPrefs(); |
| 406 | 393 |
| 407 // Create the controls that go into the pane. | 394 // Create the controls that go into the pane. |
| 408 blocked_label_ = new views::Label( | 395 blocked_label_ = new views::Label( |
| 409 l10n_util::GetStringUTF16( | 396 l10n_util::GetStringUTF16( |
| 410 prefs->GetBoolean(prefs::kBlockThirdPartyCookies) ? | 397 prefs->GetBoolean(prefs::kBlockThirdPartyCookies) ? |
| 411 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : | 398 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : |
| 412 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL)); | 399 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL)); |
| 413 blocked_label_->SetMultiLine(true); | 400 blocked_label_->SetMultiLine(true); |
| 414 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 401 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 415 const LocalSharedObjectsContainer& blocked_lsos = | 402 const LocalSharedObjectsContainer& blocked_data = |
| 416 content_settings->blocked_local_shared_objects(); | 403 content_settings->blocked_local_shared_objects(); |
| 417 string16 name = ASCIIToUTF16("Site Data"); | 404 blocked_cookies_tree_model_ = blocked_data.CreateCookiesTreeModel(); |
| 418 ContainerMap apps_map; | |
| 419 apps_map[std::string()] = new LocalDataContainer( | |
| 420 std::string(), std::string(), | |
| 421 blocked_lsos.cookies()->Clone(), | |
| 422 blocked_lsos.databases()->Clone(), | |
| 423 blocked_lsos.local_storages()->Clone(), | |
| 424 blocked_lsos.session_storages()->Clone(), | |
| 425 blocked_lsos.appcaches()->Clone(), | |
| 426 blocked_lsos.indexed_dbs()->Clone(), | |
| 427 blocked_lsos.file_systems()->Clone(), | |
| 428 NULL, | |
| 429 blocked_lsos.server_bound_certs()->Clone()); | |
| 430 | |
| 431 blocked_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, NULL, true)); | |
| 432 blocked_cookies_tree_ = new views::TreeView(); | 405 blocked_cookies_tree_ = new views::TreeView(); |
| 433 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); | 406 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); |
| 434 blocked_cookies_tree_->SetRootShown(false); | 407 blocked_cookies_tree_->SetRootShown(false); |
| 435 blocked_cookies_tree_->SetEditable(false); | 408 blocked_cookies_tree_->SetEditable(false); |
| 436 blocked_cookies_tree_->set_lines_at_root(true); | 409 blocked_cookies_tree_->set_lines_at_root(true); |
| 437 blocked_cookies_tree_->set_auto_expand_children(true); | 410 blocked_cookies_tree_->set_auto_expand_children(true); |
| 438 blocked_cookies_tree_->SetController(this); | 411 blocked_cookies_tree_->SetController(this); |
| 439 | 412 |
| 440 allow_blocked_button_ = new views::NativeTextButton(this, | 413 allow_blocked_button_ = new views::NativeTextButton(this, |
| 441 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)); | 414 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 /////////////////////////////////////////////////////////////////////////////// | 515 /////////////////////////////////////////////////////////////////////////////// |
| 543 // CollectedCookiesViews, content::NotificationObserver implementation: | 516 // CollectedCookiesViews, content::NotificationObserver implementation: |
| 544 | 517 |
| 545 void CollectedCookiesViews::Observe( | 518 void CollectedCookiesViews::Observe( |
| 546 int type, | 519 int type, |
| 547 const content::NotificationSource& source, | 520 const content::NotificationSource& source, |
| 548 const content::NotificationDetails& details) { | 521 const content::NotificationDetails& details) { |
| 549 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); | 522 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); |
| 550 window_->CloseConstrainedWindow(); | 523 window_->CloseConstrainedWindow(); |
| 551 } | 524 } |
| OLD | NEW |