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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 10911012: Upstream Android IME support (ImeAdapter). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nits fixed; recent downstream changes applied; ime adapter added to browser_jni_registrar Created 8 years, 4 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 | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index d16141b25ff6c3ad5a005f1253f50968229dae01..a1d4ed226624d787d8fe1a002f224f14e2192639 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -26,7 +26,8 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
// ContentViewCore. It being NULL means that it is not attached to the
// View system yet, so we treat it as hidden.
is_hidden_(!content_view_core),
- content_view_core_(content_view_core) {
+ content_view_core_(content_view_core),
+ ime_adapter_android_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
host_->SetView(this);
// RenderWidgetHost is initialized as visible. If is_hidden_ is true, tell
// RenderWidgetHost to hide.
@@ -178,10 +179,23 @@ void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) {
void RenderWidgetHostViewAndroid::TextInputStateChanged(
const ViewHostMsg_TextInputState_Params& params) {
- NOTIMPLEMENTED();
+ if (is_hidden_)
+ return;
+
+ content_view_core_->ImeUpdateAdapter(
+ GetNativeImeAdapter(),
+ static_cast<int>(params.type),
+ params.value, params.selection_start, params.selection_end,
+ params.composition_start, params.composition_end,
+ false /* show_ime_if_needed */);
+}
+
+int RenderWidgetHostViewAndroid::GetNativeImeAdapter() {
+ return reinterpret_cast<int>(&ime_adapter_android_);
}
void RenderWidgetHostViewAndroid::ImeCancelComposition() {
+ ime_adapter_android_.CancelComposition();
}
void RenderWidgetHostViewAndroid::DidUpdateBackingStore(
@@ -337,6 +351,14 @@ void RenderWidgetHostViewAndroid::UnlockMouse() {
NOTIMPLEMENTED();
}
+// Methods called from the host to the render
+
+void RenderWidgetHostViewAndroid::SendKeyEvent(
+ const NativeWebKeyboardEvent& event) {
+ if (host_)
+ host_->ForwardKeyboardEvent(event);
+}
+
void RenderWidgetHostViewAndroid::TouchEvent(
const WebKit::WebTouchEvent& event) {
if (host_)
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698