| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const int kInfobarVerticalPadding = 3; | 57 const int kInfobarVerticalPadding = 3; |
| 58 const int kInfobarHorizontalPadding = 8; | 58 const int kInfobarHorizontalPadding = 8; |
| 59 | 59 |
| 60 // Width of the infobar frame. | 60 // Width of the infobar frame. |
| 61 const int kInfobarBorderSize = 1; | 61 const int kInfobarBorderSize = 1; |
| 62 | 62 |
| 63 // Dimensions of the tree views. | 63 // Dimensions of the tree views. |
| 64 const int kTreeViewWidth = 400; | 64 const int kTreeViewWidth = 400; |
| 65 const int kTreeViewHeight = 125; | 65 const int kTreeViewHeight = 125; |
| 66 | 66 |
| 67 // The color of the border around the cookies tree view. | |
| 68 const SkColor kCookiesBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); | |
| 69 | |
| 70 // Spacing constants used with non-Harmony dialogs. | 67 // Spacing constants used with non-Harmony dialogs. |
| 71 const int kTabbedPaneTopPadding = 14; | 68 const int kTabbedPaneTopPadding = 14; |
| 72 const int kCookieInfoBottomPadding = 4; | 69 const int kCookieInfoBottomPadding = 4; |
| 73 | 70 |
| 74 } // namespace | 71 } // namespace |
| 75 | 72 |
| 76 // A custom view that conditionally displays an infobar. | 73 // A custom view that conditionally displays an infobar. |
| 77 class InfobarView : public views::View { | 74 class InfobarView : public views::View { |
| 78 public: | 75 public: |
| 79 InfobarView() { | 76 InfobarView() { |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); | 479 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); |
| 483 | 480 |
| 484 layout->StartRow(0, three_columns_layout_id); | 481 layout->StartRow(0, three_columns_layout_id); |
| 485 layout->AddView(allow_blocked_button_); | 482 layout->AddView(allow_blocked_button_); |
| 486 layout->AddView(for_session_blocked_button_); | 483 layout->AddView(for_session_blocked_button_); |
| 487 | 484 |
| 488 return pane; | 485 return pane; |
| 489 } | 486 } |
| 490 | 487 |
| 491 views::View* CollectedCookiesViews::CreateScrollView(views::TreeView* pane) { | 488 views::View* CollectedCookiesViews::CreateScrollView(views::TreeView* pane) { |
| 492 views::ScrollView* scroll_view = new views::ScrollView(); | 489 views::ScrollView* scroll_view = |
| 490 views::ScrollView::CreateScrollViewWithBorder(); |
| 493 scroll_view->SetContents(pane); | 491 scroll_view->SetContents(pane); |
| 494 scroll_view->SetBorder(views::CreateSolidBorder(1, kCookiesBorderColor)); | |
| 495 return scroll_view; | 492 return scroll_view; |
| 496 } | 493 } |
| 497 | 494 |
| 498 void CollectedCookiesViews::EnableControls() { | 495 void CollectedCookiesViews::EnableControls() { |
| 499 bool enable_allowed_buttons = false; | 496 bool enable_allowed_buttons = false; |
| 500 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode(); | 497 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode(); |
| 501 if (node) { | 498 if (node) { |
| 502 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); | 499 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); |
| 503 if (cookie_node->GetDetailedInfo().node_type == | 500 if (cookie_node->GetDetailedInfo().node_type == |
| 504 CookieTreeNode::DetailedInfo::TYPE_HOST) { | 501 CookieTreeNode::DetailedInfo::TYPE_HOST) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 /////////////////////////////////////////////////////////////////////////////// | 558 /////////////////////////////////////////////////////////////////////////////// |
| 562 // CollectedCookiesViews, content::NotificationObserver implementation: | 559 // CollectedCookiesViews, content::NotificationObserver implementation: |
| 563 | 560 |
| 564 void CollectedCookiesViews::Observe( | 561 void CollectedCookiesViews::Observe( |
| 565 int type, | 562 int type, |
| 566 const content::NotificationSource& source, | 563 const content::NotificationSource& source, |
| 567 const content::NotificationDetails& details) { | 564 const content::NotificationDetails& details) { |
| 568 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); | 565 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); |
| 569 GetWidget()->Close(); | 566 GetWidget()->Close(); |
| 570 } | 567 } |
| OLD | NEW |