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

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

Issue 308003019: Add DCHECK to MaskedViewTargeter::GetHitTestMask() overrides (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 class MicButtonTargeter : public views::MaskedViewTargeter { 111 class MicButtonTargeter : public views::MaskedViewTargeter {
112 public: 112 public:
113 explicit MicButtonTargeter(views::View* mic_button) 113 explicit MicButtonTargeter(views::View* mic_button)
114 : views::MaskedViewTargeter(mic_button) {} 114 : views::MaskedViewTargeter(mic_button) {}
115 virtual ~MicButtonTargeter() {} 115 virtual ~MicButtonTargeter() {}
116 116
117 private: 117 private:
118 // views::MaskedViewTargeter: 118 // views::MaskedViewTargeter:
119 virtual bool GetHitTestMask(const views::View* view, 119 virtual bool GetHitTestMask(const views::View* view,
120 gfx::Path* mask) const OVERRIDE { 120 gfx::Path* mask) const OVERRIDE {
121 DCHECK(mask);
122 DCHECK(view == masked_view());
123
121 // The mic button icon is a circle. 124 // The mic button icon is a circle.
122 gfx::Rect local_bounds = view->GetLocalBounds(); 125 gfx::Rect local_bounds = view->GetLocalBounds();
123 int radius = local_bounds.width() / 2 + kIndicatorRadiusMinOffset; 126 int radius = local_bounds.width() / 2 + kIndicatorRadiusMinOffset;
124 gfx::Point center = local_bounds.CenterPoint(); 127 gfx::Point center = local_bounds.CenterPoint();
125 center.set_y(center.y() + kIndicatorCenterOffsetY); 128 center.set_y(center.y() + kIndicatorCenterOffsetY);
126 mask->addCircle(SkIntToScalar(center.x()), 129 mask->addCircle(SkIntToScalar(center.x()),
127 SkIntToScalar(center.y()), 130 SkIntToScalar(center.y()),
128 SkIntToScalar(radius)); 131 SkIntToScalar(radius));
129 return true; 132 return true;
130 } 133 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 resource_id = IDR_APP_LIST_SPEECH_MIC_ON; 271 resource_id = IDR_APP_LIST_SPEECH_MIC_ON;
269 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH) 272 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH)
270 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING; 273 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING;
271 274
272 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 275 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
273 mic_button_->SetImage(views::Button::STATE_NORMAL, 276 mic_button_->SetImage(views::Button::STATE_NORMAL,
274 bundle.GetImageSkiaNamed(resource_id)); 277 bundle.GetImageSkiaNamed(resource_id));
275 } 278 }
276 279
277 } // namespace app_list 280 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698