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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (!return_mailbox.IsZero()) { | 70 if (!return_mailbox.IsZero()) { |
71 ack.gl_frame_data->mailbox = return_mailbox; | 71 ack.gl_frame_data->mailbox = return_mailbox; |
72 ack.gl_frame_data->size = return_size; | 72 ack.gl_frame_data->size = return_size; |
73 ack.gl_frame_data->sync_point = | 73 ack.gl_frame_data->sync_point = |
74 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); | 74 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); |
75 } | 75 } |
76 RenderWidgetHostImpl::SendSwapCompositorFrameAck( | 76 RenderWidgetHostImpl::SendSwapCompositorFrameAck( |
77 route_id, output_surface_id, renderer_host_id, ack); | 77 route_id, output_surface_id, renderer_host_id, ack); |
78 } | 78 } |
79 | 79 |
| 80 // Sends an acknowledgement to the renderer of a processed IME event. |
| 81 void SendImeEventAck(RenderWidgetHostImpl* host) { |
| 82 host->Send(new ViewMsg_ImeEventAck(host->GetRoutingID())); |
| 83 } |
| 84 |
80 } // anonymous namespace | 85 } // anonymous namespace |
81 | 86 |
82 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( | 87 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( |
83 RenderWidgetHostImpl* widget_host, | 88 RenderWidgetHostImpl* widget_host, |
84 ContentViewCoreImpl* content_view_core) | 89 ContentViewCoreImpl* content_view_core) |
85 : host_(widget_host), | 90 : host_(widget_host), |
86 needs_begin_frame_(false), | 91 needs_begin_frame_(false), |
87 are_layers_attached_(true), | 92 are_layers_attached_(true), |
88 content_view_core_(NULL), | 93 content_view_core_(NULL), |
89 ime_adapter_android_(this), | 94 ime_adapter_android_(this), |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 ui::TextInputMode input_mode) { | 396 ui::TextInputMode input_mode) { |
392 // Unused on Android, which uses OnTextInputChanged instead. | 397 // Unused on Android, which uses OnTextInputChanged instead. |
393 } | 398 } |
394 | 399 |
395 int RenderWidgetHostViewAndroid::GetNativeImeAdapter() { | 400 int RenderWidgetHostViewAndroid::GetNativeImeAdapter() { |
396 return reinterpret_cast<int>(&ime_adapter_android_); | 401 return reinterpret_cast<int>(&ime_adapter_android_); |
397 } | 402 } |
398 | 403 |
399 void RenderWidgetHostViewAndroid::OnTextInputStateChanged( | 404 void RenderWidgetHostViewAndroid::OnTextInputStateChanged( |
400 const ViewHostMsg_TextInputState_Params& params) { | 405 const ViewHostMsg_TextInputState_Params& params) { |
| 406 #if defined(OS_ANDROID) |
| 407 if (params.require_ack) { |
| 408 // Regardless of how we exit from this method, we must acknowledge that we |
| 409 // processed the input state change. |
| 410 base::ScopedClosureRunner ack_caller(base::Bind(&SendImeEventAck, host_)); |
| 411 } |
| 412 #endif |
401 if (!IsShowing()) | 413 if (!IsShowing()) |
402 return; | 414 return; |
403 | 415 |
404 content_view_core_->UpdateImeAdapter( | 416 content_view_core_->UpdateImeAdapter( |
405 GetNativeImeAdapter(), | 417 GetNativeImeAdapter(), |
406 static_cast<int>(params.type), | 418 static_cast<int>(params.type), |
407 params.value, params.selection_start, params.selection_end, | 419 params.value, params.selection_start, params.selection_end, |
408 params.composition_start, params.composition_end, | 420 params.composition_start, params.composition_end, |
409 params.show_ime_if_needed); | 421 params.show_ime_if_needed); |
410 } | 422 } |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 // RenderWidgetHostView, public: | 1156 // RenderWidgetHostView, public: |
1145 | 1157 |
1146 // static | 1158 // static |
1147 RenderWidgetHostView* | 1159 RenderWidgetHostView* |
1148 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1160 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
1149 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1161 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
1150 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1162 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
1151 } | 1163 } |
1152 | 1164 |
1153 } // namespace content | 1165 } // namespace content |
OLD | NEW |