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

Unified Diff: ppapi/cpp/dev/touch_event_dev.cc

Issue 10543159: ppapi: Add support for touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
Index: ppapi/cpp/dev/touch_event_dev.cc
diff --git a/ppapi/cpp/dev/touch_event_dev.cc b/ppapi/cpp/dev/touch_event_dev.cc
new file mode 100644
index 0000000000000000000000000000000000000000..79d5dcd362594e62a1451c6f3ddf7dd1a4125deb
--- /dev/null
+++ b/ppapi/cpp/dev/touch_event_dev.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 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 "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/point.h"
+#include "ppapi/cpp/dev/touch_event_dev.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_TouchInputEvent_Dev>() {
+ return PPB_TOUCH_INPUT_EVENT_DEV_INTERFACE;
+}
+
+} // namespace
+
+TouchInputEvent_Dev::TouchInputEvent_Dev(const InputEvent& event)
+ : InputEvent() {
+ if (!has_interface<PPB_TouchInputEvent_Dev>())
+ return;
+ // Type check the input event before setting it.
+ if (get_interface<PPB_TouchInputEvent_Dev>()->IsTouchInputEvent(
+ event.pp_resource())) {
+ Module::Get()->core()->AddRefResource(event.pp_resource());
+ PassRefFromConstructor(event.pp_resource());
+ }
+}
+
+uint32_t TouchInputEvent_Dev::GetTouchCount(PP_TouchListType list) const {
+ if (!has_interface<PPB_TouchInputEvent_Dev>())
+ return 0;
+ return get_interface<PPB_TouchInputEvent_Dev>()->GetTouchCount(pp_resource(),
+ list);
+}
+
+TouchPoint_Dev TouchInputEvent_Dev::GetTouchById(PP_TouchListType list,
+ uint32_t id) const {
+ if (!has_interface<PPB_TouchInputEvent_Dev>())
+ return TouchPoint_Dev();
+ return TouchPoint_Dev(get_interface<PPB_TouchInputEvent_Dev>()->
+ GetTouchById(pp_resource(), list, id));
+}
+
+TouchPoint_Dev TouchInputEvent_Dev::GetTouchByIndex(PP_TouchListType list,
+ uint32_t index) const {
+ if (!has_interface<PPB_TouchInputEvent_Dev>())
+ return TouchPoint_Dev();
+ return TouchPoint_Dev(get_interface<PPB_TouchInputEvent_Dev>()->
+ GetTouchByIndex(pp_resource(), list, index));
+}
+
+} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698