Index: ui/views/controls/touch/touch_hud_drawer.cc |
diff --git a/ash/touch/touch_hud_projection.cc b/ui/views/controls/touch/touch_hud_drawer.cc |
similarity index 83% |
copy from ash/touch/touch_hud_projection.cc |
copy to ui/views/controls/touch/touch_hud_drawer.cc |
index 4692de8683380790286a465cb324c966ae20280d..d735d429397382d32fe4bcc08b4b04980975f67d 100644 |
--- a/ash/touch/touch_hud_projection.cc |
+++ b/ui/views/controls/touch/touch_hud_drawer.cc |
@@ -1,20 +1,20 @@ |
-// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "ash/touch/touch_hud_projection.h" |
+#include "ui/views/controls/touch/touch_hud_drawer.h" |
-#include "ash/root_window_controller.h" |
-#include "ash/shell.h" |
#include "third_party/skia/include/effects/SkGradientShader.h" |
#include "ui/events/event.h" |
#include "ui/gfx/animation/animation_delegate.h" |
#include "ui/gfx/animation/linear_animation.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/geometry/size.h" |
+#include "ui/views/view.h" |
#include "ui/views/widget/widget.h" |
+#include "ui/views/widget/widget_observer.h" |
-namespace ash { |
+namespace views { |
const int kPointRadius = 20; |
const SkColor kProjectionFillColor = SkColorSetRGB(0xF5, 0xF5, 0xDC); |
@@ -26,11 +26,11 @@ const int kFadeoutFrameRate = 60; |
// TouchPointView draws a single touch point. This object manages its own |
// lifetime and deletes itself upon fade-out completion or whenever |Remove()| |
// is explicitly called. |
-class TouchPointView : public views::View, |
+class TouchPointView : public View, |
public gfx::AnimationDelegate, |
- public views::WidgetObserver { |
+ public WidgetObserver { |
public: |
- explicit TouchPointView(views::Widget* parent_widget) |
+ explicit TouchPointView(Widget* parent_widget) |
: circle_center_(kPointRadius + 1, kPointRadius + 1), |
gradient_center_(SkPoint::Make(kPointRadius + 1, |
kPointRadius + 1)) { |
@@ -130,23 +130,21 @@ class TouchPointView : public views::View, |
DISALLOW_COPY_AND_ASSIGN(TouchPointView); |
}; |
-TouchHudProjection::TouchHudProjection(aura::Window* initial_root) |
- : TouchObserverHUD(initial_root) { |
-} |
+TouchHudDrawer::TouchHudDrawer() {} |
-TouchHudProjection::~TouchHudProjection() { |
-} |
+TouchHudDrawer::~TouchHudDrawer() {} |
-void TouchHudProjection::Clear() { |
+void TouchHudDrawer::Clear() { |
for (std::map<int, TouchPointView*>::iterator iter = points_.begin(); |
iter != points_.end(); iter++) |
iter->second->Remove(); |
points_.clear(); |
} |
-void TouchHudProjection::OnTouchEvent(ui::TouchEvent* event) { |
+void TouchHudDrawer::HandleTouchEvent(const ui::TouchEvent* event, |
+ Widget* parent_widget) { |
if (event->type() == ui::ET_TOUCH_PRESSED) { |
- TouchPointView* point = new TouchPointView(widget()); |
+ TouchPointView* point = new TouchPointView(parent_widget); |
point->UpdateTouch(*event); |
std::pair<std::map<int, TouchPointView*>::iterator, bool> result = |
points_.insert(std::make_pair(event->touch_id(), point)); |
@@ -168,14 +166,4 @@ void TouchHudProjection::OnTouchEvent(ui::TouchEvent* event) { |
} |
} |
-void TouchHudProjection::SetHudForRootWindowController( |
- RootWindowController* controller) { |
- controller->set_touch_hud_projection(this); |
-} |
- |
-void TouchHudProjection::UnsetHudForRootWindowController( |
- RootWindowController* controller) { |
- controller->set_touch_hud_projection(NULL); |
-} |
- |
-} // namespace ash |
+} // namespace views |