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

Side by Side Diff: ash/sticky_keys/sticky_keys_overlay.cc

Issue 142523003: Renames gfx::FontList::Derive* family. (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
« no previous file with comments | « ash/ime/infolist_window.cc ('k') | build/android/pylib/gtest/filter/ui_unittests_disabled » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sticky_keys/sticky_keys_overlay.h" 5 #include "ash/sticky_keys/sticky_keys_overlay.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/sticky_keys/sticky_keys_controller.h" 9 #include "ash/sticky_keys/sticky_keys_controller.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "grit/ash_strings.h" 12 #include "grit/ash_strings.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/compositor/scoped_layer_animation_settings.h" 15 #include "ui/compositor/scoped_layer_animation_settings.h"
15 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/font_list.h" 17 #include "ui/gfx/font_list.h"
17 #include "ui/views/border.h" 18 #include "ui/views/border.h"
18 #include "ui/views/controls/label.h" 19 #include "ui/views/controls/label.h"
19 #include "ui/views/layout/box_layout.h" 20 #include "ui/views/layout/box_layout.h"
20 #include "ui/views/view.h" 21 #include "ui/views/view.h"
21 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
22 #include "ui/views/widget/widget_delegate.h" 23 #include "ui/views/widget/widget_delegate.h"
23 24
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 const gfx::Rect& text_bounds, 63 const gfx::Rect& text_bounds,
63 int flags) OVERRIDE; 64 int flags) OVERRIDE;
64 65
65 StickyKeyState state_; 66 StickyKeyState state_;
66 67
67 DISALLOW_COPY_AND_ASSIGN(StickyKeyOverlayLabel); 68 DISALLOW_COPY_AND_ASSIGN(StickyKeyOverlayLabel);
68 }; 69 };
69 70
70 StickyKeyOverlayLabel::StickyKeyOverlayLabel(const std::string& key_name) 71 StickyKeyOverlayLabel::StickyKeyOverlayLabel(const std::string& key_name)
71 : state_(STICKY_KEY_STATE_DISABLED) { 72 : state_(STICKY_KEY_STATE_DISABLED) {
73 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
74
72 SetText(base::UTF8ToUTF16(key_name)); 75 SetText(base::UTF8ToUTF16(key_name));
73 SetHorizontalAlignment(gfx::ALIGN_LEFT); 76 SetHorizontalAlignment(gfx::ALIGN_LEFT);
74 SetFontList( 77 SetFontList(rb->GetFontList(ui::ResourceBundle::LargeFont));
75 font_list().DeriveFontListWithSize(18));
76 SetAutoColorReadabilityEnabled(false); 78 SetAutoColorReadabilityEnabled(false);
77 SetFocusable(false); 79 SetFocusable(false);
78 SetEnabledColor(SkColorSetARGB(0x80, 0xFF, 0xFF, 0xFF)); 80 SetEnabledColor(SkColorSetARGB(0x80, 0xFF, 0xFF, 0xFF));
79 SetDisabledColor(SkColorSetARGB(0x80, 0xFF, 0xFF, 0xFF)); 81 SetDisabledColor(SkColorSetARGB(0x80, 0xFF, 0xFF, 0xFF));
80 } 82 }
81 83
82 StickyKeyOverlayLabel::~StickyKeyOverlayLabel() { 84 StickyKeyOverlayLabel::~StickyKeyOverlayLabel() {
83 } 85 }
84 86
85 void StickyKeyOverlayLabel::SetKeyState(StickyKeyState state) { 87 void StickyKeyOverlayLabel::SetKeyState(StickyKeyState state) {
86 state_ = state; 88 state_ = state;
87 SkColor label_color; 89 SkColor label_color;
88 int style; 90 int style;
89 switch (state) { 91 switch (state) {
90 case STICKY_KEY_STATE_ENABLED: 92 case STICKY_KEY_STATE_ENABLED:
91 style = gfx::Font::NORMAL; 93 style = gfx::Font::NORMAL;
92 label_color = SkColorSetA(enabled_color(), 0xFF); 94 label_color = SkColorSetA(enabled_color(), 0xFF);
93 break; 95 break;
94 case STICKY_KEY_STATE_LOCKED: 96 case STICKY_KEY_STATE_LOCKED:
95 style = gfx::Font::UNDERLINE; 97 style = gfx::Font::UNDERLINE;
96 label_color = SkColorSetA(enabled_color(), 0xFF); 98 label_color = SkColorSetA(enabled_color(), 0xFF);
97 break; 99 break;
98 default: 100 default:
99 style = gfx::Font::NORMAL; 101 style = gfx::Font::NORMAL;
100 label_color = SkColorSetA(enabled_color(), 0x80); 102 label_color = SkColorSetA(enabled_color(), 0x80);
101 } 103 }
102 104
103 SetEnabledColor(label_color); 105 SetEnabledColor(label_color);
104 SetDisabledColor(label_color); 106 SetDisabledColor(label_color);
105 SetFontList(font_list().DeriveFontListWithSizeDeltaAndStyle(0, style)); 107 SetFontList(font_list().DeriveWithStyle(style));
106 } 108 }
107 109
108 void StickyKeyOverlayLabel::PaintText(gfx::Canvas* canvas, 110 void StickyKeyOverlayLabel::PaintText(gfx::Canvas* canvas,
109 const base::string16& text, 111 const base::string16& text,
110 const gfx::Rect& text_bounds, 112 const gfx::Rect& text_bounds,
111 int flags) { 113 int flags) {
112 views::Label::PaintText(canvas, 114 views::Label::PaintText(canvas,
113 text, 115 text,
114 text_bounds, 116 text_bounds,
115 flags | gfx::Canvas::NO_SUBPIXEL_RENDERING); 117 flags | gfx::Canvas::NO_SUBPIXEL_RENDERING);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 ui::LayerAnimator* animator = overlay_widget_->GetLayer()->GetAnimator(); 276 ui::LayerAnimator* animator = overlay_widget_->GetLayer()->GetAnimator();
275 if (animator) 277 if (animator)
276 animator->RemoveObserver(this); 278 animator->RemoveObserver(this);
277 } 279 }
278 280
279 void StickyKeysOverlay::OnLayerAnimationScheduled( 281 void StickyKeysOverlay::OnLayerAnimationScheduled(
280 ui::LayerAnimationSequence* sequence) { 282 ui::LayerAnimationSequence* sequence) {
281 } 283 }
282 284
283 } // namespace ash 285 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ime/infolist_window.cc ('k') | build/android/pylib/gtest/filter/ui_unittests_disabled » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698