OLD | NEW |
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 "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "ui/app_list/app_list_model.h" | 9 #include "ui/app_list/app_list_model.h" |
10 #include "ui/app_list/app_list_view_delegate.h" | 10 #include "ui/app_list/app_list_view_delegate.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const SkColor kResultTextColor = SkColorSetRGB(178, 178, 178); | 46 const SkColor kResultTextColor = SkColorSetRGB(178, 178, 178); |
47 const SkColor kSoundLevelIndicatorColor = SkColorSetRGB(219, 219, 219); | 47 const SkColor kSoundLevelIndicatorColor = SkColorSetRGB(219, 219, 219); |
48 | 48 |
49 class SoundLevelIndicator : public views::View { | 49 class SoundLevelIndicator : public views::View { |
50 public: | 50 public: |
51 SoundLevelIndicator(); | 51 SoundLevelIndicator(); |
52 virtual ~SoundLevelIndicator(); | 52 virtual ~SoundLevelIndicator(); |
53 | 53 |
54 private: | 54 private: |
55 // Overridden from views::View: | 55 // Overridden from views::View: |
56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 56 virtual void OnPaint(gfx::Canvas* canvas) override; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(SoundLevelIndicator); | 58 DISALLOW_COPY_AND_ASSIGN(SoundLevelIndicator); |
59 }; | 59 }; |
60 | 60 |
61 SoundLevelIndicator::SoundLevelIndicator() {} | 61 SoundLevelIndicator::SoundLevelIndicator() {} |
62 | 62 |
63 SoundLevelIndicator::~SoundLevelIndicator() {} | 63 SoundLevelIndicator::~SoundLevelIndicator() {} |
64 | 64 |
65 void SoundLevelIndicator::OnPaint(gfx::Canvas* canvas) { | 65 void SoundLevelIndicator::OnPaint(gfx::Canvas* canvas) { |
66 SkPaint paint; | 66 SkPaint paint; |
67 paint.setStyle(SkPaint::kFill_Style); | 67 paint.setStyle(SkPaint::kFill_Style); |
68 paint.setColor(kSoundLevelIndicatorColor); | 68 paint.setColor(kSoundLevelIndicatorColor); |
69 paint.setAntiAlias(true); | 69 paint.setAntiAlias(true); |
70 canvas->DrawCircle(bounds().CenterPoint(), width() / 2, paint); | 70 canvas->DrawCircle(bounds().CenterPoint(), width() / 2, paint); |
71 } | 71 } |
72 | 72 |
73 // MicButton is an image button with a circular hit test mask. | 73 // MicButton is an image button with a circular hit test mask. |
74 class MicButton : public views::ImageButton, | 74 class MicButton : public views::ImageButton, |
75 public views::MaskedTargeterDelegate { | 75 public views::MaskedTargeterDelegate { |
76 public: | 76 public: |
77 explicit MicButton(views::ButtonListener* listener); | 77 explicit MicButton(views::ButtonListener* listener); |
78 virtual ~MicButton(); | 78 virtual ~MicButton(); |
79 | 79 |
80 private: | 80 private: |
81 // views::MaskedTargeterDelegate: | 81 // views::MaskedTargeterDelegate: |
82 virtual bool GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 82 virtual bool GetHitTestMask(gfx::Path* mask) const override; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(MicButton); | 84 DISALLOW_COPY_AND_ASSIGN(MicButton); |
85 }; | 85 }; |
86 | 86 |
87 MicButton::MicButton(views::ButtonListener* listener) | 87 MicButton::MicButton(views::ButtonListener* listener) |
88 : views::ImageButton(listener) {} | 88 : views::ImageButton(listener) {} |
89 | 89 |
90 MicButton::~MicButton() {} | 90 MicButton::~MicButton() {} |
91 | 91 |
92 bool MicButton::GetHitTestMask(gfx::Path* mask) const { | 92 bool MicButton::GetHitTestMask(gfx::Path* mask) const { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); | 246 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); |
247 speech_result_->SetEnabledColor(kHintTextColor); | 247 speech_result_->SetEnabledColor(kHintTextColor); |
248 | 248 |
249 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 249 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
250 mic_button_->SetImage(views::Button::STATE_NORMAL, | 250 mic_button_->SetImage(views::Button::STATE_NORMAL, |
251 bundle.GetImageSkiaNamed(resource_id)); | 251 bundle.GetImageSkiaNamed(resource_id)); |
252 } | 252 } |
253 | 253 |
254 } // namespace app_list | 254 } // namespace app_list |
OLD | NEW |