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

Side by Side Diff: ash/common/system/tray/hover_highlight_view.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ash/common/system/tray/hover_highlight_view.h" 5 #include "ash/common/system/tray/hover_highlight_view.h"
6 6
7 #include "ash/common/system/tray/fixed_sized_image_view.h" 7 #include "ash/common/system/tray/fixed_sized_image_view.h"
8 #include "ash/common/system/tray/tray_constants.h" 8 #include "ash/common/system/tray/tray_constants.h"
9 #include "ash/common/system/tray/view_click_listener.h" 9 #include "ash/common/system/tray/view_click_listener.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 29 matching lines...) Expand all
40 default_color_(0), 40 default_color_(0),
41 text_highlight_color_(0), 41 text_highlight_color_(0),
42 text_default_color_(0), 42 text_default_color_(0),
43 hover_(false), 43 hover_(false),
44 expandable_(false), 44 expandable_(false),
45 checkable_(false), 45 checkable_(false),
46 checked_(false) { 46 checked_(false) {
47 set_notify_enter_exit_on_child(true); 47 set_notify_enter_exit_on_child(true);
48 } 48 }
49 49
50 HoverHighlightView::~HoverHighlightView() { 50 HoverHighlightView::~HoverHighlightView() {}
51 }
52 51
53 bool HoverHighlightView::GetTooltipText(const gfx::Point& p, 52 bool HoverHighlightView::GetTooltipText(const gfx::Point& p,
54 base::string16* tooltip) const { 53 base::string16* tooltip) const {
55 if (tooltip_.empty()) 54 if (tooltip_.empty())
56 return false; 55 return false;
57 *tooltip = tooltip_; 56 *tooltip = tooltip_;
58 return true; 57 return true;
59 } 58 }
60 59
61 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, 60 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image,
62 const base::string16& text, 61 const base::string16& text,
63 bool highlight) { 62 bool highlight) {
64 SetLayoutManager(new views::BoxLayout( 63 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3,
65 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems)); 64 kTrayPopupPaddingBetweenItems));
66 DoAddIconAndLabel(image, text, highlight); 65 DoAddIconAndLabel(image, text, highlight);
67 } 66 }
68 67
69 void HoverHighlightView::AddIndentedIconAndLabel(const gfx::ImageSkia& image, 68 void HoverHighlightView::AddIndentedIconAndLabel(const gfx::ImageSkia& image,
70 const base::string16& text, 69 const base::string16& text,
71 bool highlight) { 70 bool highlight) {
72 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 71 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
73 kTrayPopupPaddingHorizontal, 0, 72 kTrayPopupPaddingHorizontal, 0,
74 kTrayPopupPaddingBetweenItems)); 73 kTrayPopupPaddingBetweenItems));
75 DoAddIconAndLabel(image, text, highlight); 74 DoAddIconAndLabel(image, text, highlight);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 views::Label* HoverHighlightView::AddCheckableLabel(const base::string16& text, 126 views::Label* HoverHighlightView::AddCheckableLabel(const base::string16& text,
128 bool highlight, 127 bool highlight,
129 bool checked) { 128 bool checked) {
130 checkable_ = true; 129 checkable_ = true;
131 checked_ = checked; 130 checked_ = checked;
132 if (checked) { 131 if (checked) {
133 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 132 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
134 const gfx::ImageSkia* check = 133 const gfx::ImageSkia* check =
135 rb.GetImageNamed(IDR_MENU_CHECK).ToImageSkia(); 134 rb.GetImageNamed(IDR_MENU_CHECK).ToImageSkia();
136 int margin = kTrayPopupPaddingHorizontal + 135 int margin = kTrayPopupPaddingHorizontal +
137 kTrayPopupDetailsLabelExtraLeftMargin - kCheckLabelPadding; 136 kTrayPopupDetailsLabelExtraLeftMargin - kCheckLabelPadding;
138 SetLayoutManager(new views::BoxLayout( 137 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3,
139 views::BoxLayout::kHorizontal, 0, 3, kCheckLabelPadding)); 138 kCheckLabelPadding));
140 views::ImageView* image_view = new FixedSizedImageView(margin, 0); 139 views::ImageView* image_view = new FixedSizedImageView(margin, 0);
141 image_view->SetImage(check); 140 image_view->SetImage(check);
142 image_view->SetHorizontalAlignment(views::ImageView::TRAILING); 141 image_view->SetHorizontalAlignment(views::ImageView::TRAILING);
143 image_view->SetEnabled(enabled()); 142 image_view->SetEnabled(enabled());
144 AddChildView(image_view); 143 AddChildView(image_view);
145 144
146 text_label_ = new views::Label(text); 145 text_label_ = new views::Label(text);
147 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 146 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
148 text_label_->SetFontList(GetFontList(highlight)); 147 text_label_->SetFontList(GetFontList(highlight));
149 text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0)); 148 text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { 241 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) {
243 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); 242 canvas->DrawColor(hover_ ? highlight_color_ : default_color_);
244 } 243 }
245 244
246 void HoverHighlightView::OnFocus() { 245 void HoverHighlightView::OnFocus() {
247 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); 246 ScrollRectToVisible(gfx::Rect(gfx::Point(), size()));
248 ActionableView::OnFocus(); 247 ActionableView::OnFocus();
249 } 248 }
250 249
251 } // namespace ash 250 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/fixed_sized_scroll_view.cc ('k') | ash/common/system/tray/special_popup_row.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698