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

Side by Side Diff: ash/common/system/tray/hover_highlight_view.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
« no previous file with comments | « ash/common/system/toast/toast_overlay.cc ('k') | ash/common/system/tray/label_tray_view.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 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_node_data.h" 10 #include "ui/accessibility/ax_node_data.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 text_label_ = new views::Label(text); 120 text_label_ = new views::Label(text);
121 int left_margin = kTrayPopupPaddingHorizontal; 121 int left_margin = kTrayPopupPaddingHorizontal;
122 int right_margin = kTrayPopupPaddingHorizontal; 122 int right_margin = kTrayPopupPaddingHorizontal;
123 if (alignment != gfx::ALIGN_CENTER) { 123 if (alignment != gfx::ALIGN_CENTER) {
124 if (base::i18n::IsRTL()) 124 if (base::i18n::IsRTL())
125 right_margin += kTrayPopupDetailsLabelExtraLeftMargin; 125 right_margin += kTrayPopupDetailsLabelExtraLeftMargin;
126 else 126 else
127 left_margin += kTrayPopupDetailsLabelExtraLeftMargin; 127 left_margin += kTrayPopupDetailsLabelExtraLeftMargin;
128 } 128 }
129 text_label_->SetBorder( 129 text_label_->SetBorder(
130 views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin)); 130 views::CreateEmptyBorder(5, left_margin, 5, right_margin));
131 text_label_->SetHorizontalAlignment(alignment); 131 text_label_->SetHorizontalAlignment(alignment);
132 text_label_->SetFontList(GetFontList(highlight)); 132 text_label_->SetFontList(GetFontList(highlight));
133 // Do not set alpha value in disable color. It will have issue with elide 133 // Do not set alpha value in disable color. It will have issue with elide
134 // blending filter in disabled state for rendering label text color. 134 // blending filter in disabled state for rendering label text color.
135 text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127)); 135 text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127));
136 if (text_default_color_) 136 if (text_default_color_)
137 text_label_->SetEnabledColor(text_default_color_); 137 text_label_->SetEnabledColor(text_default_color_);
138 text_label_->SetEnabled(enabled()); 138 text_label_->SetEnabled(enabled());
139 AddChildView(text_label_); 139 AddChildView(text_label_);
140 box_layout_->SetFlexForView(text_label_, 1); 140 box_layout_->SetFlexForView(text_label_, 1);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { 281 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) {
282 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); 282 canvas->DrawColor(hover_ ? highlight_color_ : default_color_);
283 } 283 }
284 284
285 void HoverHighlightView::OnFocus() { 285 void HoverHighlightView::OnFocus() {
286 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); 286 ScrollRectToVisible(gfx::Rect(gfx::Point(), size()));
287 ActionableView::OnFocus(); 287 ActionableView::OnFocus();
288 } 288 }
289 289
290 } // namespace ash 290 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/toast/toast_overlay.cc ('k') | ash/common/system/tray/label_tray_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698