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

Side by Side Diff: ash/system/tray/special_popup_row.cc

Issue 145033006: views: Make View::set_border() take a scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/hover_highlight_view.cc ('k') | ash/system/tray/system_tray_bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ash/system/tray/special_popup_row.h" 5 #include "ash/system/tray/special_popup_row.h"
6 6
7 #include "ash/system/tray/hover_highlight_view.h" 7 #include "ash/system/tray/hover_highlight_view.h"
8 #include "ash/system/tray/throbber_view.h" 8 #include "ash/system/tray/throbber_view.h"
9 #include "ash/system/tray/tray_constants.h" 9 #include "ash/system/tray/tray_constants.h"
10 #include "ash/system/tray/tray_popup_header_button.h" 10 #include "ash/system/tray/tray_popup_header_button.h"
(...skipping 14 matching lines...) Expand all
25 25
26 const int kIconPaddingLeft = 5; 26 const int kIconPaddingLeft = 5;
27 const int kSpecialPopupRowHeight = 55; 27 const int kSpecialPopupRowHeight = 55;
28 const int kBorderHeight = 1; 28 const int kBorderHeight = 1;
29 const SkColor kBorderColor = SkColorSetRGB(0xaa, 0xaa, 0xaa); 29 const SkColor kBorderColor = SkColorSetRGB(0xaa, 0xaa, 0xaa);
30 30
31 views::View* CreatePopupHeaderButtonsContainer() { 31 views::View* CreatePopupHeaderButtonsContainer() {
32 views::View* view = new views::View; 32 views::View* view = new views::View;
33 view->SetLayoutManager(new 33 view->SetLayoutManager(new
34 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, -1)); 34 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, -1));
35 view->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 5)); 35 view->SetBorder(views::Border::CreateEmptyBorder(0, 0, 0, 5));
36 return view; 36 return view;
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 SpecialPopupRow::SpecialPopupRow() 41 SpecialPopupRow::SpecialPopupRow()
42 : content_(NULL), 42 : content_(NULL),
43 button_container_(NULL) { 43 button_container_(NULL) {
44 set_background(views::Background::CreateSolidBackground( 44 set_background(views::Background::CreateSolidBackground(
45 kHeaderBackgroundColor)); 45 kHeaderBackgroundColor));
46 set_border(views::Border::CreateSolidSidedBorder( 46 SetBorder(views::Border::CreateSolidSidedBorder(
47 kBorderHeight, 0, 0, 0, kBorderColor)); 47 kBorderHeight, 0, 0, 0, kBorderColor));
48 SetLayoutManager( 48 SetLayoutManager(
49 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); 49 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
50 } 50 }
51 51
52 SpecialPopupRow::~SpecialPopupRow() { 52 SpecialPopupRow::~SpecialPopupRow() {
53 } 53 }
54 54
55 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { 55 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) {
56 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 56 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
57 HoverHighlightView* container = new HoverHighlightView(listener); 57 HoverHighlightView* container = new HoverHighlightView(listener);
58 container->SetLayoutManager(new 58 container->SetLayoutManager(new
59 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, kIconPaddingLeft)); 59 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, kIconPaddingLeft));
60 60
61 container->set_highlight_color(SkColorSetARGB(0, 0, 0, 0)); 61 container->set_highlight_color(SkColorSetARGB(0, 0, 0, 0));
62 container->set_default_color(SkColorSetARGB(0, 0, 0, 0)); 62 container->set_default_color(SkColorSetARGB(0, 0, 0, 0));
63 container->set_text_highlight_color(kHeaderTextColorHover); 63 container->set_text_highlight_color(kHeaderTextColorHover);
64 container->set_text_default_color(kHeaderTextColorNormal); 64 container->set_text_default_color(kHeaderTextColorNormal);
65 65
66 container->AddIconAndLabel( 66 container->AddIconAndLabel(
67 *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToImageSkia(), 67 *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToImageSkia(),
68 rb.GetLocalizedString(string_id), 68 rb.GetLocalizedString(string_id),
69 gfx::Font::BOLD); 69 gfx::Font::BOLD);
70 70
71 container->set_border(views::Border::CreateEmptyBorder(0, 71 container->SetBorder(
72 kTrayPopupPaddingHorizontal, 0, 0)); 72 views::Border::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0));
73 73
74 container->SetAccessibleName( 74 container->SetAccessibleName(
75 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_PREVIOUS_MENU)); 75 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_PREVIOUS_MENU));
76 SetContent(container); 76 SetContent(container);
77 } 77 }
78 78
79 void SpecialPopupRow::SetContent(views::View* view) { 79 void SpecialPopupRow::SetContent(views::View* view) {
80 CHECK(!content_); 80 CHECK(!content_);
81 content_ = view; 81 content_ = view;
82 AddChildViewAt(content_, 0); 82 AddChildViewAt(content_, 0);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 container_bounds.set_x(content_bounds.width() - container_bounds.width()); 125 container_bounds.set_x(content_bounds.width() - container_bounds.width());
126 button_container_->SetBoundsRect(container_bounds); 126 button_container_->SetBoundsRect(container_bounds);
127 127
128 bounds = content_->bounds(); 128 bounds = content_->bounds();
129 bounds.set_width(button_container_->x()); 129 bounds.set_width(button_container_->x());
130 content_->SetBoundsRect(bounds); 130 content_->SetBoundsRect(bounds);
131 } 131 }
132 132
133 } // namespace internal 133 } // namespace internal
134 } // namespace ash 134 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/hover_highlight_view.cc ('k') | ash/system/tray/system_tray_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698