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

Unified Diff: ppapi/cpp/input_event.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
Index: ppapi/cpp/input_event.cc
diff --git a/ppapi/cpp/input_event.cc b/ppapi/cpp/input_event.cc
index 632b1eccd93652f9f15e227e28bb9fdbf342756c..7693b201bdf25ae08daf82c602444c945bd4041c 100644
--- a/ppapi/cpp/input_event.cc
+++ b/ppapi/cpp/input_event.cc
@@ -30,6 +30,10 @@ template <> const char* interface_name<PPB_WheelInputEvent>() {
return PPB_WHEEL_INPUT_EVENT_INTERFACE;
}
+template <> const char* interface_name<PPB_CompositionInputEvent>() {
+ return PPB_COMPOSITION_INPUT_EVENT_INTERFACE;
+}
+
} // namespace
// InputEvent ------------------------------------------------------------------
@@ -218,4 +222,49 @@ Var KeyboardInputEvent::GetCharacterText() const {
pp_resource()));
}
+// CompositionInputEvent -------------------------------------------------------
+
+CompositionInputEvent::CompositionInputEvent() : InputEvent() {
+}
+
+CompositionInputEvent::CompositionInputEvent(const InputEvent& event)
+ : InputEvent() {
+ // Type check the input event before setting it.
+ if (!has_interface<PPB_CompositionInputEvent>())
+ return;
+ if (get_interface<PPB_CompositionInputEvent>()->IsCompositionInputEvent(
+ event.pp_resource())) {
+ Module::Get()->core()->AddRefResource(event.pp_resource());
+ PassRefFromConstructor(event.pp_resource());
+ }
+}
+
+Var CompositionInputEvent::GetText() const {
+ if (!has_interface<PPB_CompositionInputEvent>())
+ return Var();
+ return Var(Var::PassRef(),
+ get_interface<PPB_CompositionInputEvent>()->GetText(
+ pp_resource()));
+}
+
+uint32_t CompositionInputEvent::GetTargetSegment() const {
+ if (!has_interface<PPB_CompositionInputEvent>())
+ return 0;
+ return get_interface<PPB_CompositionInputEvent>()->GetTargetSegment(
+ pp_resource());
+}
+
+std::vector<uint32_t> CompositionInputEvent::GetSegments() const {
+ std::vector<uint32_t> result;
+ if (!has_interface<PPB_CompositionInputEvent>())
+ return result;
+ uint32_t* segments = 0;
+ uint32_t size = 0;
+ get_interface<PPB_CompositionInputEvent>()->GetSegments(pp_resource(),
+ &segments, &size);
+ if (segments && size)
+ result.assign(segments, segments+size);
+ return result;
+}
+
} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698