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

Unified Diff: ui/app_list/views/speech_view.cc

Issue 339713005: Remove MaskedViewTargeter and its derived classes (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | ui/views/masked_view_targeter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 976da57056930dad80c99630125ebf3508a3607c..e23b411f0718867f24336fc3b00b5f8df21ea868 100644
--- a/ui/app_list/views/speech_view.cc
+++ b/ui/app_list/views/speech_view.cc
@@ -21,7 +21,6 @@
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
-#include "ui/views/masked_view_targeter.h"
#include "ui/views/shadow_border.h"
namespace app_list {
@@ -94,45 +93,20 @@ bool MicButton::HasHitTestMask() const {
return true;
}
-// TODO(tdanderson): Move the implementation into views::View::HitTestRect()
-// and delete this function. See crbug.com/377527.
void MicButton::GetHitTestMask(views::View::HitTestSource source,
gfx::Path* mask) const {
- const ui::EventTargeter* targeter = GetEventTargeter();
- CHECK(targeter);
- static_cast<const views::MaskedViewTargeter*>(targeter)
- ->GetHitTestMask(this, mask);
+ DCHECK(mask);
+
+ // The mic button icon is a circle. |source| doesn't matter.
+ gfx::Rect local_bounds = GetLocalBounds();
+ int radius = local_bounds.width() / 2 + kIndicatorRadiusMinOffset;
+ gfx::Point center = local_bounds.CenterPoint();
+ center.set_y(center.y() + kIndicatorCenterOffsetY);
+ mask->addCircle(SkIntToScalar(center.x()),
+ SkIntToScalar(center.y()),
+ SkIntToScalar(radius));
}
-// Used to define the circular hit test region of a MicButton for the
-// purposes of event targeting.
-class MicButtonTargeter : public views::MaskedViewTargeter {
- public:
- explicit MicButtonTargeter(views::View* mic_button)
- : views::MaskedViewTargeter(mic_button) {}
- virtual ~MicButtonTargeter() {}
-
- private:
- // views::MaskedViewTargeter:
- virtual bool GetHitTestMask(const views::View* view,
- gfx::Path* mask) const OVERRIDE {
- DCHECK(mask);
- DCHECK_EQ(view, masked_view());
-
- // The mic button icon is a circle.
- gfx::Rect local_bounds = view->GetLocalBounds();
- int radius = local_bounds.width() / 2 + kIndicatorRadiusMinOffset;
- gfx::Point center = local_bounds.CenterPoint();
- center.set_y(center.y() + kIndicatorCenterOffsetY);
- mask->addCircle(SkIntToScalar(center.x()),
- SkIntToScalar(center.y()),
- SkIntToScalar(radius));
- return true;
- }
-
- DISALLOW_COPY_AND_ASSIGN(MicButtonTargeter);
-};
-
} // namespace
// static
@@ -166,8 +140,6 @@ SpeechView::SpeechView(AppListViewDelegate* delegate)
mic_button_ = new MicButton(this);
container->AddChildView(mic_button_);
- mic_button_->SetEventTargeter(
- scoped_ptr<ui::EventTargeter>(new MicButtonTargeter(mic_button_)));
// TODO(mukai): use BoundedLabel to cap 2 lines.
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | ui/views/masked_view_targeter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698