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

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

Issue 140693017: Clean-up: Replaces obsolete Font/FontList methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 years, 10 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 gfx::Font::FontStyle style) { 49 gfx::Font::FontStyle style) {
50 SetLayoutManager(new views::BoxLayout( 50 SetLayoutManager(new views::BoxLayout(
51 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems)); 51 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems));
52 views::ImageView* image_view = 52 views::ImageView* image_view =
53 new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); 53 new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0);
54 image_view->SetImage(image); 54 image_view->SetImage(image);
55 AddChildView(image_view); 55 AddChildView(image_view);
56 56
57 text_label_ = new views::Label(text); 57 text_label_ = new views::Label(text);
58 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 58 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
59 text_label_->SetFontList( 59 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
60 text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
61 if (text_default_color_) 60 if (text_default_color_)
62 text_label_->SetEnabledColor(text_default_color_); 61 text_label_->SetEnabledColor(text_default_color_);
63 AddChildView(text_label_); 62 AddChildView(text_label_);
64 63
65 SetAccessibleName(text); 64 SetAccessibleName(text);
66 } 65 }
67 66
68 views::Label* HoverHighlightView::AddLabel(const base::string16& text, 67 views::Label* HoverHighlightView::AddLabel(const base::string16& text,
69 gfx::Font::FontStyle style) { 68 gfx::Font::FontStyle style) {
70 SetLayoutManager(new views::FillLayout()); 69 SetLayoutManager(new views::FillLayout());
71 text_label_ = new views::Label(text); 70 text_label_ = new views::Label(text);
72 int margin = kTrayPopupPaddingHorizontal + 71 int margin = kTrayPopupPaddingHorizontal +
73 kTrayPopupDetailsLabelExtraLeftMargin; 72 kTrayPopupDetailsLabelExtraLeftMargin;
74 int left_margin = 0; 73 int left_margin = 0;
75 int right_margin = 0; 74 int right_margin = 0;
76 if (base::i18n::IsRTL()) 75 if (base::i18n::IsRTL())
77 right_margin = margin; 76 right_margin = margin;
78 else 77 else
79 left_margin = margin; 78 left_margin = margin;
80 text_label_->SetBorder( 79 text_label_->SetBorder(
81 views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin)); 80 views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin));
82 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 81 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
83 text_label_->SetFontList( 82 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
84 text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
85 // 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
86 // blending filter in disabled state for rendering label text color. 84 // blending filter in disabled state for rendering label text color.
87 text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127)); 85 text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127));
88 if (text_default_color_) 86 if (text_default_color_)
89 text_label_->SetEnabledColor(text_default_color_); 87 text_label_->SetEnabledColor(text_default_color_);
90 AddChildView(text_label_); 88 AddChildView(text_label_);
91 89
92 SetAccessibleName(text); 90 SetAccessibleName(text);
93 return text_label_; 91 return text_label_;
94 } 92 }
(...skipping 11 matching lines...) Expand all
106 kTrayPopupDetailsLabelExtraLeftMargin - kCheckLabelPadding; 104 kTrayPopupDetailsLabelExtraLeftMargin - kCheckLabelPadding;
107 SetLayoutManager(new views::BoxLayout( 105 SetLayoutManager(new views::BoxLayout(
108 views::BoxLayout::kHorizontal, 0, 3, kCheckLabelPadding)); 106 views::BoxLayout::kHorizontal, 0, 3, kCheckLabelPadding));
109 views::ImageView* image_view = new FixedSizedImageView(margin, 0); 107 views::ImageView* image_view = new FixedSizedImageView(margin, 0);
110 image_view->SetImage(check); 108 image_view->SetImage(check);
111 image_view->SetHorizontalAlignment(views::ImageView::TRAILING); 109 image_view->SetHorizontalAlignment(views::ImageView::TRAILING);
112 AddChildView(image_view); 110 AddChildView(image_view);
113 111
114 text_label_ = new views::Label(text); 112 text_label_ = new views::Label(text);
115 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 113 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
116 text_label_->SetFontList( 114 text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
117 text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
118 text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0)); 115 text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0));
119 if (text_default_color_) 116 if (text_default_color_)
120 text_label_->SetEnabledColor(text_default_color_); 117 text_label_->SetEnabledColor(text_default_color_);
121 AddChildView(text_label_); 118 AddChildView(text_label_);
122 119
123 SetAccessibleName(text); 120 SetAccessibleName(text);
124 return text_label_; 121 return text_label_;
125 } 122 }
126 return AddLabel(text, style); 123 return AddLabel(text, style);
127 } 124 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); 180 canvas->DrawColor(hover_ ? highlight_color_ : default_color_);
184 } 181 }
185 182
186 void HoverHighlightView::OnFocus() { 183 void HoverHighlightView::OnFocus() {
187 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); 184 ScrollRectToVisible(gfx::Rect(gfx::Point(), size()));
188 ActionableView::OnFocus(); 185 ActionableView::OnFocus();
189 } 186 }
190 187
191 } // namespace internal 188 } // namespace internal
192 } // namespace ash 189 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/session_length_limit/tray_session_length_limit.cc ('k') | ash/system/tray/tray_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698