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

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.h

Issue 8073021: Implement Pepper IME API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments from brettw, yzshen, and kochi. Created 9 years, 2 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: webkit/plugins/ppapi/ppapi_plugin_instance.h
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 6109278760af78b3679f5202e8e2e156c9b61bea..24b317cb9346e09c657307415a2e296f7b8658e0 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -22,6 +22,7 @@
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppb_input_event.h"
#include "ppapi/c/ppp_graphics_3d.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/shared_impl/function_group_base.h"
@@ -31,6 +32,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h"
+#include "ui/base/ime/text_input_type.h"
#include "ui/gfx/rect.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
@@ -48,14 +50,11 @@ struct PPP_Zoom_Dev;
class SkBitmap;
class TransportDIB;
-namespace gfx {
-class Rect;
-}
-
namespace WebKit {
-struct WebCursorInfo;
class WebInputEvent;
class WebPluginContainer;
+struct WebCompositionUnderline;
+struct WebCursorInfo;
}
namespace ppapi {
@@ -167,6 +166,26 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
PP_Var GetInstanceObject();
void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip);
+ // Handlers for composition events.
+ bool HandleCompositionStart(const string16& text);
+ bool HandleCompositionUpdate(
+ const string16& text,
+ const std::vector<WebKit::WebCompositionUnderline>& underlines,
+ int selection_start,
+ int selection_end);
+ bool HandleCompositionEnd(const string16& text);
+ bool HandleTextInput(const string16& text);
+
+ // Implementation of composition API.
+ void UpdateCaretPosition(const gfx::Rect& caret,
+ const gfx::Rect& bounding_box);
+ void SetTextInputType(ui::TextInputType type);
+
+ // Gets the current text input status.
+ ui::TextInputType text_input_type() const { return text_input_type_; }
+ gfx::Rect GetCaretBounds() const;
+ bool IsPluginAcceptingCompositionEvents() const;
+
// Notifications about focus changes, see has_webkit_focus_ below.
void SetWebKitFocus(bool has_focus);
void SetContentAreaFocus(bool has_focus);
@@ -399,6 +418,17 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
void DoSetCursor(WebKit::WebCursorInfo* cursor);
+ // Internal helper functions for HandleCompositionXXX().
+ bool SendCompositionEventToPlugin(
+ PP_InputEvent_Type type,
+ const string16& text);
+ bool SendCompositionEventWithUnderlineInformationToPlugin(
+ PP_InputEvent_Type type,
+ const string16& text,
+ const std::vector<WebKit::WebCompositionUnderline>& underlines,
+ int selection_start,
+ int selection_end);
+
PluginDelegate* delegate_;
scoped_refptr<PluginModule> module_;
scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_;
@@ -534,6 +564,12 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
uint32_t input_event_mask_;
uint32_t filtered_input_event_mask_;
+ // Text composition status.
+ ui::TextInputType text_input_type_;
+ gfx::Rect text_input_caret_;
+ gfx::Rect text_input_caret_bounds_;
+ bool text_input_caret_set_;
+
PP_CompletionCallback lock_mouse_callback_;
DISALLOW_COPY_AND_ASSIGN(PluginInstance);

Powered by Google App Engine
This is Rietveld 408576698