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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 allowed_lsos.cookies()->Clone(), | 338 allowed_lsos.cookies()->Clone(), |
339 allowed_lsos.databases()->Clone(), | 339 allowed_lsos.databases()->Clone(), |
340 allowed_lsos.local_storages()->Clone(), | 340 allowed_lsos.local_storages()->Clone(), |
341 allowed_lsos.session_storages()->Clone(), | 341 allowed_lsos.session_storages()->Clone(), |
342 allowed_lsos.appcaches()->Clone(), | 342 allowed_lsos.appcaches()->Clone(), |
343 allowed_lsos.indexed_dbs()->Clone(), | 343 allowed_lsos.indexed_dbs()->Clone(), |
344 allowed_lsos.file_systems()->Clone(), | 344 allowed_lsos.file_systems()->Clone(), |
345 NULL, | 345 NULL, |
346 allowed_lsos.server_bound_certs()->Clone()); | 346 allowed_lsos.server_bound_certs()->Clone()); |
347 | 347 |
348 allowed_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, true)); | 348 allowed_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, NULL, true)); |
349 allowed_cookies_tree_ = new views::TreeView(); | 349 allowed_cookies_tree_ = new views::TreeView(); |
350 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get()); | 350 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get()); |
351 allowed_cookies_tree_->SetRootShown(false); | 351 allowed_cookies_tree_->SetRootShown(false); |
352 allowed_cookies_tree_->SetEditable(false); | 352 allowed_cookies_tree_->SetEditable(false); |
353 allowed_cookies_tree_->set_lines_at_root(true); | 353 allowed_cookies_tree_->set_lines_at_root(true); |
354 allowed_cookies_tree_->set_auto_expand_children(true); | 354 allowed_cookies_tree_->set_auto_expand_children(true); |
355 allowed_cookies_tree_->SetController(this); | 355 allowed_cookies_tree_->SetController(this); |
356 | 356 |
357 block_allowed_button_ = new views::NativeTextButton(this, | 357 block_allowed_button_ = new views::NativeTextButton(this, |
358 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)); | 358 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 blocked_lsos.cookies()->Clone(), | 410 blocked_lsos.cookies()->Clone(), |
411 blocked_lsos.databases()->Clone(), | 411 blocked_lsos.databases()->Clone(), |
412 blocked_lsos.local_storages()->Clone(), | 412 blocked_lsos.local_storages()->Clone(), |
413 blocked_lsos.session_storages()->Clone(), | 413 blocked_lsos.session_storages()->Clone(), |
414 blocked_lsos.appcaches()->Clone(), | 414 blocked_lsos.appcaches()->Clone(), |
415 blocked_lsos.indexed_dbs()->Clone(), | 415 blocked_lsos.indexed_dbs()->Clone(), |
416 blocked_lsos.file_systems()->Clone(), | 416 blocked_lsos.file_systems()->Clone(), |
417 NULL, | 417 NULL, |
418 blocked_lsos.server_bound_certs()->Clone()); | 418 blocked_lsos.server_bound_certs()->Clone()); |
419 | 419 |
420 blocked_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, true)); | 420 blocked_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, NULL, true)); |
421 blocked_cookies_tree_ = new views::TreeView(); | 421 blocked_cookies_tree_ = new views::TreeView(); |
422 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); | 422 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); |
423 blocked_cookies_tree_->SetRootShown(false); | 423 blocked_cookies_tree_->SetRootShown(false); |
424 blocked_cookies_tree_->SetEditable(false); | 424 blocked_cookies_tree_->SetEditable(false); |
425 blocked_cookies_tree_->set_lines_at_root(true); | 425 blocked_cookies_tree_->set_lines_at_root(true); |
426 blocked_cookies_tree_->set_auto_expand_children(true); | 426 blocked_cookies_tree_->set_auto_expand_children(true); |
427 blocked_cookies_tree_->SetController(this); | 427 blocked_cookies_tree_->SetController(this); |
428 | 428 |
429 allow_blocked_button_ = new views::NativeTextButton(this, | 429 allow_blocked_button_ = new views::NativeTextButton(this, |
430 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)); | 430 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 468 |
469 return pane; | 469 return pane; |
470 } | 470 } |
471 | 471 |
472 void CollectedCookiesViews::EnableControls() { | 472 void CollectedCookiesViews::EnableControls() { |
473 bool enable_allowed_buttons = false; | 473 bool enable_allowed_buttons = false; |
474 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode(); | 474 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode(); |
475 if (node) { | 475 if (node) { |
476 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); | 476 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); |
477 if (cookie_node->GetDetailedInfo().node_type == | 477 if (cookie_node->GetDetailedInfo().node_type == |
478 CookieTreeNode::DetailedInfo::TYPE_ORIGIN) { | 478 CookieTreeNode::DetailedInfo::TYPE_HOST) { |
479 enable_allowed_buttons = static_cast<CookieTreeOriginNode*>( | 479 enable_allowed_buttons = static_cast<CookieTreeHostNode*>( |
480 cookie_node)->CanCreateContentException(); | 480 cookie_node)->CanCreateContentException(); |
481 } | 481 } |
482 } | 482 } |
483 block_allowed_button_->SetEnabled(enable_allowed_buttons); | 483 block_allowed_button_->SetEnabled(enable_allowed_buttons); |
484 | 484 |
485 bool enable_blocked_buttons = false; | 485 bool enable_blocked_buttons = false; |
486 node = blocked_cookies_tree_->GetSelectedNode(); | 486 node = blocked_cookies_tree_->GetSelectedNode(); |
487 if (node) { | 487 if (node) { |
488 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); | 488 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); |
489 if (cookie_node->GetDetailedInfo().node_type == | 489 if (cookie_node->GetDetailedInfo().node_type == |
490 CookieTreeNode::DetailedInfo::TYPE_ORIGIN) { | 490 CookieTreeNode::DetailedInfo::TYPE_HOST) { |
491 enable_blocked_buttons = static_cast<CookieTreeOriginNode*>( | 491 enable_blocked_buttons = static_cast<CookieTreeHostNode*>( |
492 cookie_node)->CanCreateContentException(); | 492 cookie_node)->CanCreateContentException(); |
493 } | 493 } |
494 } | 494 } |
495 allow_blocked_button_->SetEnabled(enable_blocked_buttons); | 495 allow_blocked_button_->SetEnabled(enable_blocked_buttons); |
496 for_session_blocked_button_->SetEnabled(enable_blocked_buttons); | 496 for_session_blocked_button_->SetEnabled(enable_blocked_buttons); |
497 } | 497 } |
498 | 498 |
499 void CollectedCookiesViews::ShowCookieInfo() { | 499 void CollectedCookiesViews::ShowCookieInfo() { |
500 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode(); | 500 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode(); |
501 if (!node) | 501 if (!node) |
(...skipping 10 matching lines...) Expand all Loading... |
512 } else { | 512 } else { |
513 cookie_info_view_->ClearCookieDisplay(); | 513 cookie_info_view_->ClearCookieDisplay(); |
514 } | 514 } |
515 } else { | 515 } else { |
516 cookie_info_view_->ClearCookieDisplay(); | 516 cookie_info_view_->ClearCookieDisplay(); |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 void CollectedCookiesViews::AddContentException(views::TreeView* tree_view, | 520 void CollectedCookiesViews::AddContentException(views::TreeView* tree_view, |
521 ContentSetting setting) { | 521 ContentSetting setting) { |
522 CookieTreeOriginNode* origin_node = | 522 CookieTreeHostNode* host_node = |
523 static_cast<CookieTreeOriginNode*>(tree_view->GetSelectedNode()); | 523 static_cast<CookieTreeHostNode*>(tree_view->GetSelectedNode()); |
524 Profile* profile = tab_contents_->profile(); | 524 Profile* profile = tab_contents_->profile(); |
525 origin_node->CreateContentException( | 525 host_node->CreateContentException( |
526 CookieSettings::Factory::GetForProfile(profile), setting); | 526 CookieSettings::Factory::GetForProfile(profile), setting); |
527 infobar_->UpdateVisibility(true, setting, origin_node->GetTitle()); | 527 infobar_->UpdateVisibility(true, setting, host_node->GetTitle()); |
528 status_changed_ = true; | 528 status_changed_ = true; |
529 } | 529 } |
530 | 530 |
531 /////////////////////////////////////////////////////////////////////////////// | 531 /////////////////////////////////////////////////////////////////////////////// |
532 // CollectedCookiesViews, content::NotificationObserver implementation: | 532 // CollectedCookiesViews, content::NotificationObserver implementation: |
533 | 533 |
534 void CollectedCookiesViews::Observe( | 534 void CollectedCookiesViews::Observe( |
535 int type, | 535 int type, |
536 const content::NotificationSource& source, | 536 const content::NotificationSource& source, |
537 const content::NotificationDetails& details) { | 537 const content::NotificationDetails& details) { |
538 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); | 538 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); |
539 window_->CloseConstrainedWindow(); | 539 window_->CloseConstrainedWindow(); |
540 } | 540 } |
OLD | NEW |