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

Unified Diff: views/touchui/gesture_manager.cc

Issue 3192002: Added entry points to view/View to dispatch and process TouchEvents. (Closed) Base URL: git://codf21.jail.google.com/chromium.git
Patch Set: final changes Created 10 years, 3 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 | « views/touchui/gesture_manager.h ('k') | views/view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/touchui/gesture_manager.cc
diff --git a/views/touchui/gesture_manager.cc b/views/touchui/gesture_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..71235198d8dbffa4805959ea3cfe145f3c3ac3d7
--- /dev/null
+++ b/views/touchui/gesture_manager.cc
@@ -0,0 +1,62 @@
+// Copyright (c) 2010 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 "views/touchui/gesture_manager.h"
+#ifndef NDEBUG
+#include <iostream>
+#endif
+
+#include "base/logging.h"
+#include "views/event.h"
+#include "views/view.h"
+
+namespace views {
+
+GestureManager::~GestureManager() {
+}
+
+GestureManager* GestureManager::Get() {
+ return Singleton<GestureManager>::get();
+}
+
+bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event,
+ View* source,
+ bool previouslyHandled) {
+ // TODO(rjkroege): A realistic version of the GestureManager will
+ // appear in a subsequent CL. This interim version permits verifying that the
+ // event distirbution code works by turning all touch inputs into
+ // mouse approximations.
+ bool handled = false;
+ if (event.GetType() == Event::ET_TOUCH_PRESSED) {
+ DLOG(INFO) << "GestureManager::ProcessTouchEventForGesture: " <<
+ "TouchPressed\n";
+ MouseEvent mouse_event(Event::ET_MOUSE_PRESSED, event.x(), event.y(),
+ event.GetFlags());
+ source->OnMousePressed(mouse_event);
+ handled = true;
+ } else if (event.GetType() == Event::ET_TOUCH_RELEASED) {
+ DLOG(INFO) << "GestureManager::ProcessTouchEventForGesture: " <<
+ "TouchReleased\n";
+ MouseEvent mouse_event(Event::ET_MOUSE_RELEASED, event.x(), event.y(),
+ event.GetFlags());
+ source->OnMouseReleased(mouse_event, false);
+ handled = true;
+ } else if (event.GetType() == Event::ET_TOUCH_MOVED) {
+ DLOG(INFO) << "GestureManager::ProcessTouchEventForGesture: " <<
+ "TouchMotion\n";
+ MouseEvent mouse_event(Event::ET_MOUSE_DRAGGED, event.x(), event.y(),
+ event.GetFlags());
+ source->OnMouseDragged(mouse_event);
+ handled = true;
+ } else {
+ DLOG(INFO) << "GestureManager::ProcessTouchEventForGesture: " <<
+ "unhandled event\n";
+ }
+ return handled;
+}
+
+GestureManager::GestureManager() {
+}
+
+} // namespace views
« no previous file with comments | « views/touchui/gesture_manager.h ('k') | views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698