| 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 CookieTreeNode::DetailedInfo::TYPE_HOST) { | 490 CookieTreeNode::DetailedInfo::TYPE_HOST) { |
| 491 enable_blocked_buttons = static_cast<CookieTreeHostNode*>( | 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_->IsDrawn() ? |
| 501 if (!node) | 501 allowed_cookies_tree_->GetSelectedNode() : nullptr; |
| 502 |
| 503 if (!node && blocked_cookies_tree_->IsDrawn()) |
| 502 node = blocked_cookies_tree_->GetSelectedNode(); | 504 node = blocked_cookies_tree_->GetSelectedNode(); |
| 503 | 505 |
| 504 if (node) { | 506 if (node) { |
| 505 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); | 507 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); |
| 506 const CookieTreeNode::DetailedInfo detailed_info = | 508 const CookieTreeNode::DetailedInfo detailed_info = |
| 507 cookie_node->GetDetailedInfo(); | 509 cookie_node->GetDetailedInfo(); |
| 508 | 510 |
| 509 if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) { | 511 if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) { |
| 510 cookie_info_view_->SetCookie(detailed_info.cookie->Domain(), | 512 cookie_info_view_->SetCookie(detailed_info.cookie->Domain(), |
| 511 *detailed_info.cookie); | 513 *detailed_info.cookie); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 532 /////////////////////////////////////////////////////////////////////////////// | 534 /////////////////////////////////////////////////////////////////////////////// |
| 533 // CollectedCookiesViews, content::NotificationObserver implementation: | 535 // CollectedCookiesViews, content::NotificationObserver implementation: |
| 534 | 536 |
| 535 void CollectedCookiesViews::Observe( | 537 void CollectedCookiesViews::Observe( |
| 536 int type, | 538 int type, |
| 537 const content::NotificationSource& source, | 539 const content::NotificationSource& source, |
| 538 const content::NotificationDetails& details) { | 540 const content::NotificationDetails& details) { |
| 539 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); | 541 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); |
| 540 GetWidget()->Close(); | 542 GetWidget()->Close(); |
| 541 } | 543 } |
| OLD | NEW |