OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (!return_mailbox.IsZero()) { | 68 if (!return_mailbox.IsZero()) { |
69 ack.gl_frame_data->mailbox = return_mailbox; | 69 ack.gl_frame_data->mailbox = return_mailbox; |
70 ack.gl_frame_data->size = return_size; | 70 ack.gl_frame_data->size = return_size; |
71 ack.gl_frame_data->sync_point = | 71 ack.gl_frame_data->sync_point = |
72 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); | 72 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); |
73 } | 73 } |
74 RenderWidgetHostImpl::SendSwapCompositorFrameAck( | 74 RenderWidgetHostImpl::SendSwapCompositorFrameAck( |
75 route_id, output_surface_id, renderer_host_id, ack); | 75 route_id, output_surface_id, renderer_host_id, ack); |
76 } | 76 } |
77 | 77 |
| 78 // Sends an acknowledgement to the renderer of a processed IME event. |
| 79 void SendImeEventAck(RenderWidgetHostImpl* host) { |
| 80 host->Send(new ViewMsg_ImeEventAck(host->GetRoutingID())); |
| 81 } |
| 82 |
78 } // anonymous namespace | 83 } // anonymous namespace |
79 | 84 |
80 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( | 85 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( |
81 RenderWidgetHostImpl* widget_host, | 86 RenderWidgetHostImpl* widget_host, |
82 ContentViewCoreImpl* content_view_core) | 87 ContentViewCoreImpl* content_view_core) |
83 : host_(widget_host), | 88 : host_(widget_host), |
84 needs_begin_frame_(false), | 89 needs_begin_frame_(false), |
85 are_layers_attached_(true), | 90 are_layers_attached_(true), |
86 content_view_core_(NULL), | 91 content_view_core_(NULL), |
87 ime_adapter_android_(this), | 92 ime_adapter_android_(this), |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 ui::TextInputMode input_mode) { | 393 ui::TextInputMode input_mode) { |
389 // Unused on Android, which uses OnTextInputChanged instead. | 394 // Unused on Android, which uses OnTextInputChanged instead. |
390 } | 395 } |
391 | 396 |
392 int RenderWidgetHostViewAndroid::GetNativeImeAdapter() { | 397 int RenderWidgetHostViewAndroid::GetNativeImeAdapter() { |
393 return reinterpret_cast<int>(&ime_adapter_android_); | 398 return reinterpret_cast<int>(&ime_adapter_android_); |
394 } | 399 } |
395 | 400 |
396 void RenderWidgetHostViewAndroid::OnTextInputStateChanged( | 401 void RenderWidgetHostViewAndroid::OnTextInputStateChanged( |
397 const ViewHostMsg_TextInputState_Params& params) { | 402 const ViewHostMsg_TextInputState_Params& params) { |
| 403 #if defined(OS_ANDROID) |
| 404 if (params.require_ack) { |
| 405 // Regardless of how we exit from this method, we must acknowledge that we |
| 406 // processed the input state change. |
| 407 base::ScopedClosureRunner ackCaller(base::Bind(&SendImeEventAck, host_)); |
| 408 } |
| 409 #endif |
398 if (!IsShowing()) | 410 if (!IsShowing()) |
399 return; | 411 return; |
400 | 412 |
401 content_view_core_->UpdateImeAdapter( | 413 content_view_core_->UpdateImeAdapter( |
402 GetNativeImeAdapter(), | 414 GetNativeImeAdapter(), |
403 static_cast<int>(params.type), | 415 static_cast<int>(params.type), |
404 params.value, params.selection_start, params.selection_end, | 416 params.value, params.selection_start, params.selection_end, |
405 params.composition_start, params.composition_end, | 417 params.composition_start, params.composition_end, |
406 params.show_ime_if_needed); | 418 params.show_ime_if_needed); |
407 } | 419 } |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 // RenderWidgetHostView, public: | 1146 // RenderWidgetHostView, public: |
1135 | 1147 |
1136 // static | 1148 // static |
1137 RenderWidgetHostView* | 1149 RenderWidgetHostView* |
1138 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1150 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
1139 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1151 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
1140 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1152 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
1141 } | 1153 } |
1142 | 1154 |
1143 } // namespace content | 1155 } // namespace content |
OLD | NEW |