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

Side by Side Diff: ppapi/thunk/ppb_input_event_thunk.cc

Issue 10391101: Test for Pepper IME events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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
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/c/pp_errors.h" 5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/thunk/thunk.h" 6 #include "ppapi/thunk/thunk.h"
7 #include "ppapi/thunk/enter.h" 7 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/ppb_input_event_api.h" 8 #include "ppapi/thunk/ppb_input_event_api.h"
9 #include "ppapi/thunk/ppb_instance_api.h" 9 #include "ppapi/thunk/ppb_instance_api.h"
10 #include "ppapi/thunk/resource_creation_api.h" 10 #include "ppapi/thunk/resource_creation_api.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 PP_Bool IsIMEInputEvent(PP_Resource resource) { 296 PP_Bool IsIMEInputEvent(PP_Resource resource) {
297 if (!IsInputEvent(resource)) 297 if (!IsInputEvent(resource))
298 return PP_FALSE; // Prevent warning log in GetType. 298 return PP_FALSE; // Prevent warning log in GetType.
299 PP_InputEvent_Type type = GetType(resource); 299 PP_InputEvent_Type type = GetType(resource);
300 return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START || 300 return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START ||
301 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE || 301 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE ||
302 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END || 302 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END ||
303 type == PP_INPUTEVENT_TYPE_IME_TEXT); 303 type == PP_INPUTEVENT_TYPE_IME_TEXT);
304 } 304 }
305 305
306 PP_Resource CreateIMEInputEvent(PP_Instance instance,
307 PP_InputEvent_Type type,
308 PP_TimeTicks time_stamp,
309 PP_Var text,
310 uint32_t segment_number,
311 const uint32_t segment_offsets[],
312 int32_t target_segment,
313 uint32_t selection_start,
314 uint32_t selection_end) {
315 EnterResourceCreation enter(instance);
316 if (enter.failed())
317 return 0;
318 return enter.functions()->CreateIMEInputEvent(instance, type, time_stamp,
319 text, segment_number,
320 segment_offsets,
321 target_segment,
322 selection_start,
323 selection_end);
324 }
325
306 PP_Var GetIMEText(PP_Resource ime_event) { 326 PP_Var GetIMEText(PP_Resource ime_event) {
307 return GetCharacterText(ime_event); 327 return GetCharacterText(ime_event);
308 } 328 }
309 329
310 uint32_t GetIMESegmentNumber(PP_Resource ime_event) { 330 uint32_t GetIMESegmentNumber(PP_Resource ime_event) {
311 EnterInputEvent enter(ime_event, true); 331 EnterInputEvent enter(ime_event, true);
312 if (enter.failed()) 332 if (enter.failed())
313 return 0; 333 return 0;
314 return enter.object()->GetIMESegmentNumber(); 334 return enter.object()->GetIMESegmentNumber();
315 } 335 }
(...skipping 17 matching lines...) Expand all
333 if (enter.failed()) { 353 if (enter.failed()) {
334 if (start) 354 if (start)
335 *start = 0; 355 *start = 0;
336 if (end) 356 if (end)
337 *end = 0; 357 *end = 0;
338 return; 358 return;
339 } 359 }
340 enter.object()->GetIMESelection(start, end); 360 enter.object()->GetIMESelection(start, end);
341 } 361 }
342 362
343 const PPB_IMEInputEvent_Dev g_ppb_ime_input_event_thunk = { 363 const PPB_IMEInputEvent_Dev_0_1 g_ppb_ime_input_event_0_1_thunk = {
344 &IsIMEInputEvent, 364 &IsIMEInputEvent,
345 &GetIMEText, 365 &GetIMEText,
346 &GetIMESegmentNumber, 366 &GetIMESegmentNumber,
347 &GetIMESegmentOffset, 367 &GetIMESegmentOffset,
348 &GetIMETargetSegment, 368 &GetIMETargetSegment,
349 &GetIMESelection 369 &GetIMESelection
350 }; 370 };
351 371
372 const PPB_IMEInputEvent_Dev_0_2 g_ppb_ime_input_event_0_2_thunk = {
373 &IsIMEInputEvent,
374 &CreateIMEInputEvent,
375 &GetIMEText,
376 &GetIMESegmentNumber,
377 &GetIMESegmentOffset,
378 &GetIMETargetSegment,
379 &GetIMESelection
380 };
381
352 } // namespace 382 } // namespace
353 383
354 const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() { 384 const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() {
355 return &g_ppb_input_event_thunk; 385 return &g_ppb_input_event_thunk;
356 } 386 }
357 387
358 const PPB_MouseInputEvent_1_0* GetPPB_MouseInputEvent_1_0_Thunk() { 388 const PPB_MouseInputEvent_1_0* GetPPB_MouseInputEvent_1_0_Thunk() {
359 return &g_ppb_mouse_input_event_1_0_thunk; 389 return &g_ppb_mouse_input_event_1_0_thunk;
360 } 390 }
361 391
362 const PPB_MouseInputEvent_1_1* GetPPB_MouseInputEvent_1_1_Thunk() { 392 const PPB_MouseInputEvent_1_1* GetPPB_MouseInputEvent_1_1_Thunk() {
363 return &g_ppb_mouse_input_event_1_1_thunk; 393 return &g_ppb_mouse_input_event_1_1_thunk;
364 } 394 }
365 395
366 const PPB_KeyboardInputEvent_1_0* GetPPB_KeyboardInputEvent_1_0_Thunk() { 396 const PPB_KeyboardInputEvent_1_0* GetPPB_KeyboardInputEvent_1_0_Thunk() {
367 return &g_ppb_keyboard_input_event_thunk; 397 return &g_ppb_keyboard_input_event_thunk;
368 } 398 }
369 399
370 const PPB_KeyboardInputEvent_Dev_0_1* 400 const PPB_KeyboardInputEvent_Dev_0_1*
371 GetPPB_KeyboardInputEvent_Dev_0_1_Thunk() { 401 GetPPB_KeyboardInputEvent_Dev_0_1_Thunk() {
372 return &g_ppb_keyboard_input_event_dev_thunk; 402 return &g_ppb_keyboard_input_event_dev_thunk;
373 } 403 }
374 404
375 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() { 405 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() {
376 return &g_ppb_wheel_input_event_thunk; 406 return &g_ppb_wheel_input_event_thunk;
377 } 407 }
378 408
379 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { 409 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() {
380 return &g_ppb_ime_input_event_thunk; 410 return &g_ppb_ime_input_event_0_1_thunk;
411 }
412
413 const PPB_IMEInputEvent_Dev_0_2* GetPPB_IMEInputEvent_Dev_0_2_Thunk() {
414 return &g_ppb_ime_input_event_0_2_thunk;
381 } 415 }
382 416
383 } // namespace thunk 417 } // namespace thunk
384 } // namespace ppapi 418 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698