Index: ui/app_list/views/speech_view.cc |
diff --git a/ui/app_list/views/speech_view.cc b/ui/app_list/views/speech_view.cc |
index 9b92e7e158a621f6fa6d358f34f14a35cddeae52..9cb99fb3d37eb82b56c268358945bfeafc3995d9 100644 |
--- a/ui/app_list/views/speech_view.cc |
+++ b/ui/app_list/views/speech_view.cc |
@@ -17,7 +17,6 @@ |
#include "ui/gfx/path.h" |
#include "ui/views/animation/bounds_animator.h" |
#include "ui/views/background.h" |
-#include "ui/views/controls/button/image_button.h" |
#include "ui/views/controls/image_view.h" |
#include "ui/views/controls/label.h" |
#include "ui/views/layout/fill_layout.h" |
@@ -69,35 +68,17 @@ void SoundLevelIndicator::OnPaint(gfx::Canvas* canvas) { |
canvas->DrawCircle(bounds().CenterPoint(), width() / 2, paint); |
} |
-// MicButton is an image button with circular hit area. |
-class MicButton : public views::ImageButton { |
- public: |
- explicit MicButton(views::ButtonListener* listener); |
- virtual ~MicButton(); |
- |
- private: |
- // Overridden from views::View: |
- virtual bool HasHitTestMask() const OVERRIDE; |
- virtual void GetHitTestMaskDeprecated(views::View::HitTestSource source, |
- gfx::Path* mask) const OVERRIDE; |
- |
- DISALLOW_COPY_AND_ASSIGN(MicButton); |
-}; |
+} // namespace |
MicButton::MicButton(views::ButtonListener* listener) |
: views::ImageButton(listener) {} |
MicButton::~MicButton() {} |
-bool MicButton::HasHitTestMask() const { |
- return true; |
-} |
- |
-void MicButton::GetHitTestMaskDeprecated(views::View::HitTestSource source, |
- gfx::Path* mask) const { |
+bool MicButton::GetHitTestMask(gfx::Path* mask) const { |
DCHECK(mask); |
- // The mic button icon is a circle. |source| doesn't matter. |
+ // The mic button icon is a circle. |
gfx::Rect local_bounds = GetLocalBounds(); |
int radius = local_bounds.width() / 2 + kIndicatorRadiusMinOffset; |
gfx::Point center = local_bounds.CenterPoint(); |
@@ -105,10 +86,9 @@ void MicButton::GetHitTestMaskDeprecated(views::View::HitTestSource source, |
mask->addCircle(SkIntToScalar(center.x()), |
SkIntToScalar(center.y()), |
SkIntToScalar(radius)); |
+ return true; |
} |
-} // namespace |
- |
// static |
SpeechView::SpeechView(AppListViewDelegate* delegate) |
@@ -140,6 +120,8 @@ SpeechView::SpeechView(AppListViewDelegate* delegate) |
mic_button_ = new MicButton(this); |
container->AddChildView(mic_button_); |
+ mic_button_->SetEventTargeter( |
+ scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(mic_button_))); |
// TODO(mukai): use BoundedLabel to cap 2 lines. |
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |