OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |