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

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: 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
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..dd0c9018f5712a282c73ccb7b7f5bcd5b38b27b7 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(
+ reinterpret_cast<int>(&ime_adapter_android_),
bulach 2012/08/31 11:36:24 nit: could use GetNativeImeAdapter() here.
olilan 2012/08/31 16:47:10 Done.
+ 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_)

Powered by Google App Engine
This is Rietveld 408576698