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

Side by Side Diff: ash/ime/candidate_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
« no previous file with comments | « no previous file | ash/system/chromeos/audio/tray_audio.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 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/ime/candidate_view.h" 5 #include "ash/ime/candidate_view.h"
6 6
7 #include "ash/ime/candidate_window_constants.h" 7 #include "ash/ime/candidate_window_constants.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "ui/base/ime/candidate_window.h" 9 #include "ui/base/ime/candidate_window.h"
10 #include "ui/gfx/color_utils.h" 10 #include "ui/gfx/color_utils.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 views::Label* CreateShortcutLabel( 45 views::Label* CreateShortcutLabel(
46 ui::CandidateWindow::Orientation orientation, 46 ui::CandidateWindow::Orientation orientation,
47 const ui::NativeTheme& theme) { 47 const ui::NativeTheme& theme) {
48 // Create the shortcut label. The label will be owned by 48 // Create the shortcut label. The label will be owned by
49 // |wrapped_shortcut_label|, hence it's deleted when 49 // |wrapped_shortcut_label|, hence it's deleted when
50 // |wrapped_shortcut_label| is deleted. 50 // |wrapped_shortcut_label| is deleted.
51 views::Label* shortcut_label = new views::Label; 51 views::Label* shortcut_label = new views::Label;
52 52
53 if (orientation == ui::CandidateWindow::VERTICAL) { 53 if (orientation == ui::CandidateWindow::VERTICAL) {
54 shortcut_label->SetFontList( 54 shortcut_label->SetFontList(
55 shortcut_label->font_list().DeriveFontListWithSizeDeltaAndStyle( 55 shortcut_label->font_list().Derive(kFontSizeDelta, gfx::Font::BOLD));
56 kFontSizeDelta, gfx::Font::BOLD));
57 } else { 56 } else {
58 shortcut_label->SetFontList( 57 shortcut_label->SetFontList(
59 shortcut_label->font_list().DeriveFontListWithSizeDelta( 58 shortcut_label->font_list().DeriveWithSizeDelta(kFontSizeDelta));
60 kFontSizeDelta));
61 } 59 }
62 // TODO(satorux): Maybe we need to use language specific fonts for 60 // TODO(satorux): Maybe we need to use language specific fonts for
63 // candidate_label, like Chinese font for Chinese input method? 61 // candidate_label, like Chinese font for Chinese input method?
64 shortcut_label->SetEnabledColor(theme.GetSystemColor( 62 shortcut_label->SetEnabledColor(theme.GetSystemColor(
65 ui::NativeTheme::kColorId_LabelEnabledColor)); 63 ui::NativeTheme::kColorId_LabelEnabledColor));
66 shortcut_label->SetDisabledColor(theme.GetSystemColor( 64 shortcut_label->SetDisabledColor(theme.GetSystemColor(
67 ui::NativeTheme::kColorId_LabelDisabledColor)); 65 ui::NativeTheme::kColorId_LabelDisabledColor));
68 66
69 // Setup paddings. 67 // Setup paddings.
70 const gfx::Insets kVerticalShortcutLabelInsets(1, 6, 1, 6); 68 const gfx::Insets kVerticalShortcutLabelInsets(1, 6, 1, 6);
(...skipping 30 matching lines...) Expand all
101 // Create the candidate label. The label will be added to |this| as a 99 // Create the candidate label. The label will be added to |this| as a
102 // child view, hence it's deleted when |this| is deleted. 100 // child view, hence it's deleted when |this| is deleted.
103 if (orientation == ui::CandidateWindow::VERTICAL) { 101 if (orientation == ui::CandidateWindow::VERTICAL) {
104 candidate_label = new VerticalCandidateLabel; 102 candidate_label = new VerticalCandidateLabel;
105 } else { 103 } else {
106 candidate_label = new views::Label; 104 candidate_label = new views::Label;
107 } 105 }
108 106
109 // Change the font size. 107 // Change the font size.
110 candidate_label->SetFontList( 108 candidate_label->SetFontList(
111 candidate_label->font_list().DeriveFontListWithSizeDelta(kFontSizeDelta)); 109 candidate_label->font_list().DeriveWithSizeDelta(kFontSizeDelta));
112 candidate_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 110 candidate_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
113 111
114 return candidate_label; 112 return candidate_label;
115 } 113 }
116 114
117 // Creates the annotation label, and return it (never returns NULL). 115 // Creates the annotation label, and return it (never returns NULL).
118 // The label text is not set in this function. 116 // The label text is not set in this function.
119 views::Label* CreateAnnotationLabel( 117 views::Label* CreateAnnotationLabel(
120 ui::CandidateWindow::Orientation orientation, 118 ui::CandidateWindow::Orientation orientation,
121 const ui::NativeTheme& theme) { 119 const ui::NativeTheme& theme) {
122 // Create the annotation label. 120 // Create the annotation label.
123 views::Label* annotation_label = new views::Label; 121 views::Label* annotation_label = new views::Label;
124 122
125 // Change the font size and color. 123 // Change the font size and color.
126 annotation_label->SetFontList( 124 annotation_label->SetFontList(
127 annotation_label->font_list().DeriveFontListWithSizeDelta( 125 annotation_label->font_list().DeriveWithSizeDelta(kFontSizeDelta));
128 kFontSizeDelta));
129 annotation_label->SetEnabledColor(theme.GetSystemColor( 126 annotation_label->SetEnabledColor(theme.GetSystemColor(
130 ui::NativeTheme::kColorId_LabelDisabledColor)); 127 ui::NativeTheme::kColorId_LabelDisabledColor));
131 annotation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 128 annotation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
132 129
133 return annotation_label; 130 return annotation_label;
134 } 131 }
135 132
136 } // namespace 133 } // namespace
137 134
138 CandidateView::CandidateView( 135 CandidateView::CandidateView(
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 277 }
281 278
282 // Reserves the margin for infolist_icon even if it's not visible. 279 // Reserves the margin for infolist_icon even if it's not visible.
283 size.Enlarge( 280 size.Enlarge(
284 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); 281 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0);
285 return size; 282 return size;
286 } 283 }
287 284
288 } // namespace ime 285 } // namespace ime
289 } // namespace ash 286 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/audio/tray_audio.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698