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

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

Issue 342053003: Use OnPaint() to paint the content of IndicatorView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "third_party/skia/include/core/SkPath.h" 10 #include "third_party/skia/include/core/SkPath.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Paint(gfx::Canvas* canvas, 56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
57 const views::CullSet& cull_set) OVERRIDE;
58 57
59 DISALLOW_COPY_AND_ASSIGN(SoundLevelIndicator); 58 DISALLOW_COPY_AND_ASSIGN(SoundLevelIndicator);
60 }; 59 };
61 60
62 SoundLevelIndicator::SoundLevelIndicator() {} 61 SoundLevelIndicator::SoundLevelIndicator() {}
63 62
64 SoundLevelIndicator::~SoundLevelIndicator() {} 63 SoundLevelIndicator::~SoundLevelIndicator() {}
65 64
66 void SoundLevelIndicator::Paint(gfx::Canvas* canvas, 65 void SoundLevelIndicator::OnPaint(gfx::Canvas* canvas) {
67 const views::CullSet& cull_set) {
68 SkPaint paint; 66 SkPaint paint;
69 paint.setStyle(SkPaint::kFill_Style); 67 paint.setStyle(SkPaint::kFill_Style);
70 paint.setColor(kSoundLevelIndicatorColor); 68 paint.setColor(kSoundLevelIndicatorColor);
71 paint.setAntiAlias(true); 69 paint.setAntiAlias(true);
72 canvas->DrawCircle(bounds().CenterPoint(), width() / 2, paint); 70 canvas->DrawCircle(bounds().CenterPoint(), width() / 2, paint);
73 } 71 }
74 72
75 // MicButton is an image button with circular hit area. 73 // MicButton is an image button with circular hit area.
76 class MicButton : public views::ImageButton { 74 class MicButton : public views::ImageButton {
77 public: 75 public:
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 274 }
277 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); 275 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id));
278 speech_result_->SetEnabledColor(kHintTextColor); 276 speech_result_->SetEnabledColor(kHintTextColor);
279 277
280 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 278 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
281 mic_button_->SetImage(views::Button::STATE_NORMAL, 279 mic_button_->SetImage(views::Button::STATE_NORMAL,
282 bundle.GetImageSkiaNamed(resource_id)); 280 bundle.GetImageSkiaNamed(resource_id));
283 } 281 }
284 282
285 } // namespace app_list 283 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698