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

Unified Diff: ppapi/examples/ime/ime.cc

Issue 18671004: PPAPI: Move IMEInputEvent and TextInput to stable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 5 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/examples/ime/ime.cc
diff --git a/ppapi/examples/ime/ime.cc b/ppapi/examples/ime/ime.cc
index 6f3e65569aaba38f60f6a8fa4ba4a6e5bd3f7d0e..a5fbdc520fed273f592153d338bca22135526d64 100644
--- a/ppapi/examples/ime/ime.cc
+++ b/ppapi/examples/ime/ime.cc
@@ -10,8 +10,6 @@
#include "ppapi/c/ppb_console.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/dev/font_dev.h"
-#include "ppapi/cpp/dev/ime_input_event_dev.h"
-#include "ppapi/cpp/dev/text_input_dev.h"
#include "ppapi/cpp/graphics_2d.h"
#include "ppapi/cpp/image_data.h"
#include "ppapi/cpp/input_event.h"
@@ -19,6 +17,7 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/size.h"
+#include "ppapi/cpp/text_input_controller.h"
namespace {
@@ -112,21 +111,11 @@ class TextFieldStatusNotifyingHandler : public TextFieldStatusHandler {
textinput_control_.SetTextInputType(PP_TEXTINPUT_TYPE_NONE);
}
virtual void UpdateSelection(const std::string& text) {
- textinput_control_.SetSelectionText(text);
- textinput_control_.SelectionChanged();
+ textinput_control_.UpdateSurroundingText(text, 0, text.size());
}
private:
- class MyTextInput : public pp::TextInput_Dev {
- public:
- MyTextInput(pp::Instance* instance) : pp::TextInput_Dev(instance) {}
- virtual void RequestSurroundingText(uint32_t characters) {
- UpdateSurroundingText(selection_text_, 0, selection_text_.size());
- }
- void SetSelectionText(const std::string& text) { selection_text_ = text; }
- std::string selection_text_;
- };
- MyTextInput textinput_control_;
+ pp::TextInputController textinput_control_;
};
// Hand-made text field for demonstrating text input API.
@@ -428,7 +417,8 @@ class MyInstance : public pp::Instance {
//
// When a plugin never wants to accept text input, at initialization
// explicitly turn off the text input feature by calling:
- pp::TextInput_Dev(this).SetTextInputType(PP_TEXTINPUT_TYPE_NONE);
+ pp::TextInputController(this).SetTextInputType(
+ PP_TEXTINPUT_TYPE_NONE);
} else if (argv[i] == std::string("unaware")) {
// Demonstrating the behavior of IME-unaware plugins.
// Never call any text input related APIs.
@@ -502,25 +492,25 @@ class MyInstance : public pp::Instance {
break;
}
case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: {
- const pp::IMEInputEvent_Dev imeEvent(event);
+ const pp::IMEInputEvent imeEvent(event);
Log("CompositionStart [" + imeEvent.GetText().AsString() + "]");
ret = true;
break;
}
case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: {
- const pp::IMEInputEvent_Dev imeEvent(event);
+ const pp::IMEInputEvent imeEvent(event);
Log("CompositionUpdate [" + imeEvent.GetText().AsString() + "]");
ret = OnCompositionUpdate(imeEvent);
break;
}
case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END: {
- const pp::IMEInputEvent_Dev imeEvent(event);
+ const pp::IMEInputEvent imeEvent(event);
Log("CompositionEnd [" + imeEvent.GetText().AsString() + "]");
ret = OnCompositionEnd(imeEvent);
break;
}
case PP_INPUTEVENT_TYPE_IME_TEXT: {
- const pp::IMEInputEvent_Dev imeEvent(event);
+ const pp::IMEInputEvent imeEvent(event);
Log("ImeText [" + imeEvent.GetText().AsString() + "]");
ret = OnImeText(imeEvent);
break;
@@ -541,7 +531,7 @@ class MyInstance : public pp::Instance {
}
private:
- bool OnCompositionUpdate(const pp::IMEInputEvent_Dev& ev) {
+ bool OnCompositionUpdate(const pp::IMEInputEvent& ev) {
for (std::vector<MyTextField>::iterator it = textfield_.begin();
it != textfield_.end();
++it) {
@@ -560,7 +550,7 @@ class MyInstance : public pp::Instance {
return false;
}
- bool OnCompositionEnd(const pp::IMEInputEvent_Dev& ev) {
+ bool OnCompositionEnd(const pp::IMEInputEvent& ev) {
for (std::vector<MyTextField>::iterator it = textfield_.begin();
it != textfield_.end();
++it) {
@@ -667,7 +657,7 @@ class MyInstance : public pp::Instance {
return false;
}
- bool OnImeText(const pp::IMEInputEvent_Dev ev) {
+ bool OnImeText(const pp::IMEInputEvent ev) {
for (std::vector<MyTextField>::iterator it = textfield_.begin();
it != textfield_.end();
++it) {

Powered by Google App Engine
This is Rietveld 408576698