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

Side by Side Diff: ui/app_list/views/speech_view.cc

Issue 142523003: Renames gfx::FontList::Derive* family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/app_list/views/speech_view.h" 5 #include "ui/app_list/views/speech_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "grit/ui_strings.h" 9 #include "grit/ui_strings.h"
10 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
11 #include "ui/app_list/app_list_view_delegate.h" 11 #include "ui/app_list/app_list_view_delegate.h"
12 #include "ui/app_list/speech_ui_model.h" 12 #include "ui/app_list/speech_ui_model.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/base/resource/resource_bundle.h"
15 #include "ui/gfx/canvas.h" 15 #include "ui/gfx/canvas.h"
16 #include "ui/views/animation/bounds_animator.h" 16 #include "ui/views/animation/bounds_animator.h"
17 #include "ui/views/background.h" 17 #include "ui/views/background.h"
18 #include "ui/views/controls/button/image_button.h" 18 #include "ui/views/controls/button/image_button.h"
19 #include "ui/views/controls/label.h" 19 #include "ui/views/controls/label.h"
20 #include "ui/views/layout/fill_layout.h" 20 #include "ui/views/layout/fill_layout.h"
21 #include "ui/views/shadow_border.h" 21 #include "ui/views/shadow_border.h"
22 22
23 namespace app_list { 23 namespace app_list {
24 24
25 namespace { 25 namespace {
26 26
27 const int kShadowOffset = 1; 27 const int kShadowOffset = 1;
28 const int kShadowBlur = 4; 28 const int kShadowBlur = 4;
29 const int kSpeechViewMaxHeight = 300; 29 const int kSpeechViewMaxHeight = 300;
30 const int kTextSize = 20;
31 const int kMicButtonMargin = 12; 30 const int kMicButtonMargin = 12;
32 const int kTextMargin = 32; 31 const int kTextMargin = 32;
33 const int kIndicatorRadiusMax = 100; 32 const int kIndicatorRadiusMax = 100;
34 const int kIndicatorAnimationDuration = 100; 33 const int kIndicatorAnimationDuration = 100;
35 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0); 34 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0);
36 const SkColor kHintTextColor = SkColorSetRGB(119, 119, 119); 35 const SkColor kHintTextColor = SkColorSetRGB(119, 119, 119);
37 const SkColor kResultTextColor = SkColorSetRGB(178, 178, 178); 36 const SkColor kResultTextColor = SkColorSetRGB(178, 178, 178);
38 const SkColor kSoundLevelIndicatorColor = SkColorSetRGB(219, 219, 219); 37 const SkColor kSoundLevelIndicatorColor = SkColorSetRGB(219, 219, 219);
39 38
40 class SoundLevelIndicator : public views::View { 39 class SoundLevelIndicator : public views::View {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 108
110 // TODO(mukai): add Google logo. 109 // TODO(mukai): add Google logo.
111 indicator_ = new SoundLevelIndicator(); 110 indicator_ = new SoundLevelIndicator();
112 indicator_->SetVisible(false); 111 indicator_->SetVisible(false);
113 container->AddChildView(indicator_); 112 container->AddChildView(indicator_);
114 113
115 mic_button_ = new MicButton(this); 114 mic_button_ = new MicButton(this);
116 container->AddChildView(mic_button_); 115 container->AddChildView(mic_button_);
117 116
118 // TODO(mukai): use BoundedLabel to cap 2 lines. 117 // TODO(mukai): use BoundedLabel to cap 2 lines.
119 speech_result_ = new views::Label(); 118 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
Alexei Svitkine (slow) 2014/01/20 15:38:10 Nit: Non-const refs are discouraged (even though I
Yuki 2014/01/23 15:24:19 Done.
119 speech_result_ = new views::Label(
120 base::string16(), bundle.GetFontList(ui::ResourceBundle::LargeFont));
120 speech_result_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 121 speech_result_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
121 const gfx::FontList& font_list = speech_result_->font_list(); 122
122 speech_result_->SetFontList(font_list.DeriveFontListWithSize(kTextSize));
123 speech_result_->SetMultiLine(true); 123 speech_result_->SetMultiLine(true);
124 container->AddChildView(speech_result_); 124 container->AddChildView(speech_result_);
125 125
126 AddChildView(container); 126 AddChildView(container);
127 127
128 delegate_->GetSpeechUI()->AddObserver(this); 128 delegate_->GetSpeechUI()->AddObserver(this);
129 indicator_animator_.reset(new views::BoundsAnimator(container)); 129 indicator_animator_.reset(new views::BoundsAnimator(container));
130 indicator_animator_->SetAnimationDuration(kIndicatorAnimationDuration); 130 indicator_animator_->SetAnimationDuration(kIndicatorAnimationDuration);
131 indicator_animator_->set_tween_type(gfx::Tween::LINEAR); 131 indicator_animator_->set_tween_type(gfx::Tween::LINEAR);
132 132
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 resource_id = IDR_APP_LIST_SPEECH_MIC_ON; 213 resource_id = IDR_APP_LIST_SPEECH_MIC_ON;
214 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH) 214 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH)
215 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING; 215 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING;
216 216
217 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 217 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
218 mic_button_->SetImage(views::Button::STATE_NORMAL, bundle.GetImageSkiaNamed( 218 mic_button_->SetImage(views::Button::STATE_NORMAL, bundle.GetImageSkiaNamed(
219 resource_id)); 219 resource_id));
220 } 220 }
221 221
222 } // namespace app_list 222 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698