Index: content/browser/renderer_host/ime_adapter_android.h |
=================================================================== |
--- content/browser/renderer_host/ime_adapter_android.h (revision 255633) |
+++ content/browser/renderer_host/ime_adapter_android.h (working copy) |
@@ -8,9 +8,12 @@ |
#include <jni.h> |
#include "base/android/jni_helper.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/strings/string16.h" |
namespace content { |
+class RenderFrameHost; |
class RenderWidgetHostImpl; |
class RenderWidgetHostViewAndroid; |
struct NativeWebKeyboardEvent; |
@@ -20,14 +23,15 @@ |
// corresponding host view. |
// Ownership of these objects remains on the native side (see |
// RenderWidgetHostViewAndroid). |
-class ImeAdapterAndroid { |
+class ImeAdapterAndroid : public base::RefCountedThreadSafe<ImeAdapterAndroid> { |
public: |
explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva); |
- ~ImeAdapterAndroid(); |
// Called from java -> native |
// The java side is responsible to translate android KeyEvent various enums |
// and values into the corresponding blink::WebInputEvent. |
+ // Since these methods are not called on the UI thread, they must be proxied |
+ // to the UI thread. |
bool SendKeyEvent(JNIEnv* env, jobject, |
jobject original_key_event, |
int action, int meta_state, |
@@ -57,9 +61,30 @@ |
// Called from native -> java |
void CancelComposition(); |
void FocusedNodeChanged(bool is_editable_node); |
+ void RenderWidgetGone(); |
private: |
+ friend class base::RefCountedThreadSafe<ImeAdapterAndroid>; |
+ ~ImeAdapterAndroid(); |
+ |
+ void SendSyntheticKeyEventOnUI(const NativeWebKeyboardEvent& event); |
+ void SendKeyEventOnUI(const NativeWebKeyboardEvent& event, |
+ const NativeWebKeyboardEvent& char_event, |
+ bool key_down_text_insertion); |
+ void SetComposingTextOnUI(const base::string16& text16, int new_cursor_pos); |
+ void CommitTextOnUI(const base::string16& text16); |
+ void FinishComposingTextsOnUI(); |
+ void SetEditableSelectionOffsetsOnUI(int start, int end); |
+ void SetComposingRegiontOnUI(int start, int end); |
+ void DeleteSurroundingTextOnUI(int before, int after); |
+ void UnselectOnUI(); |
+ void SelectAllOnUI(); |
+ void CutOnUI(); |
+ void CopyOnUI(); |
+ void PasteOnUI(); |
+ |
RenderWidgetHostImpl* GetRenderWidgetHostImpl(); |
+ RenderFrameHost* GetFocusedFrame(); |
RenderWidgetHostViewAndroid* rwhva_; |
JavaObjectWeakGlobalRef java_ime_adapter_; |