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

Side by Side Diff: ppapi/cpp/input_event.cc

Issue 10873074: ppapi: Make sure the touch-event interface is detected correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/ppapi/ppapi_browsertest.cc ('k') | ppapi/examples/input/pointer_event_input.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/cpp/input_event.h" 5 #include "ppapi/cpp/input_event.h"
6 6
7 #include "ppapi/cpp/instance_handle.h" 7 #include "ppapi/cpp/instance_handle.h"
8 #include "ppapi/cpp/module.h" 8 #include "ppapi/cpp/module.h"
9 #include "ppapi/cpp/module_impl.h" 9 #include "ppapi/cpp/module_impl.h"
10 #include "ppapi/cpp/point.h" 10 #include "ppapi/cpp/point.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (!has_interface<PPB_TouchInputEvent_1_0>()) 231 if (!has_interface<PPB_TouchInputEvent_1_0>())
232 return; 232 return;
233 // Type check the input event before setting it. 233 // Type check the input event before setting it.
234 if (get_interface<PPB_TouchInputEvent_1_0>()->IsTouchInputEvent( 234 if (get_interface<PPB_TouchInputEvent_1_0>()->IsTouchInputEvent(
235 event.pp_resource())) { 235 event.pp_resource())) {
236 Module::Get()->core()->AddRefResource(event.pp_resource()); 236 Module::Get()->core()->AddRefResource(event.pp_resource());
237 PassRefFromConstructor(event.pp_resource()); 237 PassRefFromConstructor(event.pp_resource());
238 } 238 }
239 } 239 }
240 240
241 TouchInputEvent::TouchInputEvent(const InstanceHandle& instance,
242 PP_InputEvent_Type type,
243 PP_TimeTicks time_stamp,
244 uint32_t modifiers) {
245 // Type check the input event before setting it.
246 if (!has_interface<PPB_TouchInputEvent_1_0>())
247 return;
248 PassRefFromConstructor(get_interface<PPB_TouchInputEvent_1_0>()->Create(
249 instance.pp_instance(), type, time_stamp, modifiers));
250 }
251
241 void TouchInputEvent::AddTouchPoint(PP_TouchListType list, 252 void TouchInputEvent::AddTouchPoint(PP_TouchListType list,
242 PP_TouchPoint point) { 253 PP_TouchPoint point) {
243 if (!has_interface<PPB_TouchInputEvent_1_0>()) 254 if (!has_interface<PPB_TouchInputEvent_1_0>())
244 return; 255 return;
245 get_interface<PPB_TouchInputEvent_1_0>()->AddTouchPoint(pp_resource(), list, 256 get_interface<PPB_TouchInputEvent_1_0>()->AddTouchPoint(pp_resource(), list,
246 &point); 257 &point);
247 } 258 }
248 259
249 uint32_t TouchInputEvent::GetTouchCount(PP_TouchListType list) const { 260 uint32_t TouchInputEvent::GetTouchCount(PP_TouchListType list) const {
250 if (!has_interface<PPB_TouchInputEvent_1_0>()) 261 if (!has_interface<PPB_TouchInputEvent_1_0>())
(...skipping 12 matching lines...) Expand all
263 274
264 TouchPoint TouchInputEvent::GetTouchByIndex(PP_TouchListType list, 275 TouchPoint TouchInputEvent::GetTouchByIndex(PP_TouchListType list,
265 uint32_t index) const { 276 uint32_t index) const {
266 if (!has_interface<PPB_TouchInputEvent_1_0>()) 277 if (!has_interface<PPB_TouchInputEvent_1_0>())
267 return TouchPoint(); 278 return TouchPoint();
268 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()-> 279 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()->
269 GetTouchByIndex(pp_resource(), list, index)); 280 GetTouchByIndex(pp_resource(), list, index));
270 } 281 }
271 282
272 } // namespace pp 283 } // namespace pp
OLDNEW
« no previous file with comments | « chrome/test/ppapi/ppapi_browsertest.cc ('k') | ppapi/examples/input/pointer_event_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698