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

Unified Diff: ppapi/thunk/ppb_input_event_thunk.cc

Issue 7621010: Never submit: tentative Pepper IME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: snapshot. Created 9 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 | « ppapi/thunk/ppb_input_event_api.h ('k') | ppapi/thunk/ppb_text_input_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_input_event_thunk.cc
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index bd28495a90ac3926605c3a600cc4e04fe464558e..be646f7ccfb39d65e90e326dac92922fe65ac96e 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -271,6 +271,64 @@ const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
&GetCharacterText
};
+// Keyboard --------------------------------------------------------------------
+
+PP_Bool IsCompositionInputEvent(PP_Resource resource) {
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_COMPOSITION_START ||
+ type == PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE ||
+ type == PP_INPUTEVENT_TYPE_COMPOSITION_END ||
+ type == PP_INPUTEVENT_TYPE_IME_TEXT);
+}
+
+PP_Var GetCompositionText(PP_Resource composition_event) {
+ return GetCharacterText(composition_event);
+}
+
+void GetCompositionSegments(PP_Resource composition_event,
+ void* segments,
+ uint32_t* size) {
+ EnterInputEvent enter(composition_event, true);
+ if (enter.failed()) {
+ if (size)
+ *size = 0;
+ return;
+ }
+ enter.object()->GetCompositionSegments(static_cast<uint32_t**>(segments),
+ size);
+}
+
+int32_t GetCompositionTargetSegment(PP_Resource composition_event) {
+ EnterInputEvent enter(composition_event, true);
+ if (enter.failed())
+ return -1;
+ return enter.object()->GetCompositionTargetSegment();
+}
+
+void GetCompositionSelection(PP_Resource composition_event,
+ uint32_t* start,
+ uint32_t* end) {
+ EnterInputEvent enter(composition_event, true);
+ if (enter.failed()) {
+ if (start)
+ *start = 0;
+ if (end)
+ *end = 0;
+ return;
+ }
+ enter.object()->GetCompositionSelection(start, end);
+}
+
+const PPB_CompositionInputEvent g_ppb_composition_input_event_thunk = {
+ &IsCompositionInputEvent,
+ &GetCompositionText,
+ &GetCompositionSegments,
+ &GetCompositionTargetSegment,
+ &GetCompositionSelection
+};
+
} // namespace
const PPB_InputEvent* GetPPB_InputEvent_Thunk() {
@@ -293,5 +351,9 @@ const PPB_WheelInputEvent* GetPPB_WheelInputEvent_Thunk() {
return &g_ppb_wheel_input_event_thunk;
}
+const PPB_CompositionInputEvent* GetPPB_CompositionInputEvent_Thunk() {
+ return &g_ppb_composition_input_event_thunk;
+}
+
} // namespace thunk
} // namespace ppapi
« no previous file with comments | « ppapi/thunk/ppb_input_event_api.h ('k') | ppapi/thunk/ppb_text_input_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698