Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: chrome/browser/ui/views/collected_cookies_views.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 } // namespace 74 } // namespace
75 75
76 // A custom view that conditionally displays an infobar. 76 // A custom view that conditionally displays an infobar.
77 class InfobarView : public views::View { 77 class InfobarView : public views::View {
78 public: 78 public:
79 InfobarView() { 79 InfobarView() {
80 content_ = new views::View; 80 content_ = new views::View;
81 SkColor border_color = SK_ColorGRAY; 81 SkColor border_color = SK_ColorGRAY;
82 content_->SetBorder( 82 content_->SetBorder(
83 views::Border::CreateSolidBorder(kInfobarBorderSize, border_color)); 83 views::CreateSolidBorder(kInfobarBorderSize, border_color));
84 84
85 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 85 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
86 info_image_ = new views::ImageView(); 86 info_image_ = new views::ImageView();
87 info_image_->SetImage(rb.GetImageSkiaNamed(IDR_INFO)); 87 info_image_->SetImage(rb.GetImageSkiaNamed(IDR_INFO));
88 label_ = new views::Label(); 88 label_ = new views::Label();
89 } 89 }
90 ~InfobarView() override {} 90 ~InfobarView() override {}
91 91
92 // Update the visibility of the infobar. If |is_visible| is true, a rule for 92 // Update the visibility of the infobar. If |is_visible| is true, a rule for
93 // |setting| on |domain_name| was created. 93 // |setting| on |domain_name| was created.
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 layout->StartRow(0, three_columns_layout_id); 457 layout->StartRow(0, three_columns_layout_id);
458 layout->AddView(allow_blocked_button_); 458 layout->AddView(allow_blocked_button_);
459 layout->AddView(for_session_blocked_button_); 459 layout->AddView(for_session_blocked_button_);
460 460
461 return pane; 461 return pane;
462 } 462 }
463 463
464 views::View* CollectedCookiesViews::CreateScrollView(views::TreeView* pane) { 464 views::View* CollectedCookiesViews::CreateScrollView(views::TreeView* pane) {
465 views::ScrollView* scroll_view = new views::ScrollView(); 465 views::ScrollView* scroll_view = new views::ScrollView();
466 scroll_view->SetContents(pane); 466 scroll_view->SetContents(pane);
467 scroll_view->SetBorder( 467 scroll_view->SetBorder(views::CreateSolidBorder(1, kCookiesBorderColor));
468 views::Border::CreateSolidBorder(1, kCookiesBorderColor));
469 return scroll_view; 468 return scroll_view;
470 } 469 }
471 470
472 void CollectedCookiesViews::EnableControls() { 471 void CollectedCookiesViews::EnableControls() {
473 bool enable_allowed_buttons = false; 472 bool enable_allowed_buttons = false;
474 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode(); 473 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode();
475 if (node) { 474 if (node) {
476 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); 475 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node);
477 if (cookie_node->GetDetailedInfo().node_type == 476 if (cookie_node->GetDetailedInfo().node_type ==
478 CookieTreeNode::DetailedInfo::TYPE_HOST) { 477 CookieTreeNode::DetailedInfo::TYPE_HOST) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 /////////////////////////////////////////////////////////////////////////////// 534 ///////////////////////////////////////////////////////////////////////////////
536 // CollectedCookiesViews, content::NotificationObserver implementation: 535 // CollectedCookiesViews, content::NotificationObserver implementation:
537 536
538 void CollectedCookiesViews::Observe( 537 void CollectedCookiesViews::Observe(
539 int type, 538 int type,
540 const content::NotificationSource& source, 539 const content::NotificationSource& source,
541 const content::NotificationDetails& details) { 540 const content::NotificationDetails& details) {
542 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); 541 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type);
543 GetWidget()->Close(); 542 GetWidget()->Close();
544 } 543 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | chrome/browser/ui/views/cookie_info_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698