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_->HasFocus() ? |
sky
2016/09/22 19:35:15
How come you are checking focus and not visibilty?
Elly Fong-Jones
2016/09/23 12:38:08
Hm. I originally did this because both trees had v
| |
501 if (!node) | 501 allowed_cookies_tree_->GetSelectedNode() : nullptr; |
502 node = blocked_cookies_tree_->GetSelectedNode(); | 502 if (!node) { |
503 node = blocked_cookies_tree_->HasFocus() ? | |
504 blocked_cookies_tree_->GetSelectedNode() : nullptr; | |
505 } | |
503 | 506 |
504 if (node) { | 507 if (node) { |
505 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); | 508 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); |
506 const CookieTreeNode::DetailedInfo detailed_info = | 509 const CookieTreeNode::DetailedInfo detailed_info = |
507 cookie_node->GetDetailedInfo(); | 510 cookie_node->GetDetailedInfo(); |
508 | 511 |
509 if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) { | 512 if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) { |
510 cookie_info_view_->SetCookie(detailed_info.cookie->Domain(), | 513 cookie_info_view_->SetCookie(detailed_info.cookie->Domain(), |
511 *detailed_info.cookie); | 514 *detailed_info.cookie); |
512 } else { | 515 } else { |
(...skipping 19 matching lines...) Expand all Loading... | |
532 /////////////////////////////////////////////////////////////////////////////// | 535 /////////////////////////////////////////////////////////////////////////////// |
533 // CollectedCookiesViews, content::NotificationObserver implementation: | 536 // CollectedCookiesViews, content::NotificationObserver implementation: |
534 | 537 |
535 void CollectedCookiesViews::Observe( | 538 void CollectedCookiesViews::Observe( |
536 int type, | 539 int type, |
537 const content::NotificationSource& source, | 540 const content::NotificationSource& source, |
538 const content::NotificationDetails& details) { | 541 const content::NotificationDetails& details) { |
539 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); | 542 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); |
540 GetWidget()->Close(); | 543 GetWidget()->Close(); |
541 } | 544 } |
OLD | NEW |