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

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

Issue 210903003: Implemented system tray UI for new account management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge conflicts resolved. Created 6 years, 8 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.h ('k') | ash/system/tray/system_tray_delegate.h » ('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/system/tray/hover_highlight_view.h" 5 #include "ash/system/tray/hover_highlight_view.h"
6 6
7 #include "ash/system/tray/fixed_sized_image_view.h" 7 #include "ash/system/tray/fixed_sized_image_view.h"
8 #include "ash/system/tray/tray_constants.h" 8 #include "ash/system/tray/tray_constants.h"
9 #include "ash/system/tray/view_click_listener.h" 9 #include "ash/system/tray/view_click_listener.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 57 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
58 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style)); 58 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
59 if (text_default_color_) 59 if (text_default_color_)
60 text_label_->SetEnabledColor(text_default_color_); 60 text_label_->SetEnabledColor(text_default_color_);
61 AddChildView(text_label_); 61 AddChildView(text_label_);
62 62
63 SetAccessibleName(text); 63 SetAccessibleName(text);
64 } 64 }
65 65
66 views::Label* HoverHighlightView::AddLabel(const base::string16& text, 66 views::Label* HoverHighlightView::AddLabel(const base::string16& text,
67 gfx::HorizontalAlignment alignment,
67 gfx::Font::FontStyle style) { 68 gfx::Font::FontStyle style) {
68 SetLayoutManager(new views::FillLayout()); 69 SetLayoutManager(new views::FillLayout());
69 text_label_ = new views::Label(text); 70 text_label_ = new views::Label(text);
70 int margin = kTrayPopupPaddingHorizontal + 71 int left_margin = kTrayPopupPaddingHorizontal;
71 kTrayPopupDetailsLabelExtraLeftMargin; 72 int right_margin = kTrayPopupPaddingHorizontal;
72 int left_margin = 0; 73 if (alignment != gfx::ALIGN_CENTER) {
73 int right_margin = 0; 74 if (base::i18n::IsRTL())
74 if (base::i18n::IsRTL()) 75 right_margin += kTrayPopupDetailsLabelExtraLeftMargin;
75 right_margin = margin; 76 else
76 else 77 left_margin += kTrayPopupDetailsLabelExtraLeftMargin;
77 left_margin = margin; 78 }
78 text_label_->SetBorder( 79 text_label_->SetBorder(
79 views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin)); 80 views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin));
80 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 81 text_label_->SetHorizontalAlignment(alignment);
81 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style)); 82 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
82 // Do not set alpha value in disable color. It will have issue with elide 83 // Do not set alpha value in disable color. It will have issue with elide
83 // blending filter in disabled state for rendering label text color. 84 // blending filter in disabled state for rendering label text color.
84 text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127)); 85 text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127));
85 if (text_default_color_) 86 if (text_default_color_)
86 text_label_->SetEnabledColor(text_default_color_); 87 text_label_->SetEnabledColor(text_default_color_);
87 AddChildView(text_label_); 88 AddChildView(text_label_);
88 89
89 SetAccessibleName(text); 90 SetAccessibleName(text);
90 return text_label_; 91 return text_label_;
(...skipping 21 matching lines...) Expand all
112 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 113 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
113 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style)); 114 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
114 text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0)); 115 text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0));
115 if (text_default_color_) 116 if (text_default_color_)
116 text_label_->SetEnabledColor(text_default_color_); 117 text_label_->SetEnabledColor(text_default_color_);
117 AddChildView(text_label_); 118 AddChildView(text_label_);
118 119
119 SetAccessibleName(text); 120 SetAccessibleName(text);
120 return text_label_; 121 return text_label_;
121 } 122 }
122 return AddLabel(text, style); 123 return AddLabel(text, gfx::ALIGN_LEFT, style);
123 } 124 }
124 125
125 void HoverHighlightView::SetExpandable(bool expandable) { 126 void HoverHighlightView::SetExpandable(bool expandable) {
126 if (expandable != expandable_) { 127 if (expandable != expandable_) {
127 expandable_ = expandable; 128 expandable_ = expandable;
128 InvalidateLayout(); 129 InvalidateLayout();
129 } 130 }
130 } 131 }
131 132
132 bool HoverHighlightView::PerformAction(const ui::Event& event) { 133 bool HoverHighlightView::PerformAction(const ui::Event& event) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { 180 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) {
180 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); 181 canvas->DrawColor(hover_ ? highlight_color_ : default_color_);
181 } 182 }
182 183
183 void HoverHighlightView::OnFocus() { 184 void HoverHighlightView::OnFocus() {
184 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); 185 ScrollRectToVisible(gfx::Rect(gfx::Point(), size()));
185 ActionableView::OnFocus(); 186 ActionableView::OnFocus();
186 } 187 }
187 188
188 } // namespace ash 189 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/hover_highlight_view.h ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698