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

Side by Side Diff: content/browser/renderer_host/ime_adapter_android.cc

Issue 1877073003: Respect the order of input messages from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add DCHECKs for thread Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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/ime_adapter_android.h" 5 #include "content/browser/renderer_host/ime_adapter_android.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <android/input.h> 8 #include <android/input.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
12 #include "base/android/jni_array.h" 12 #include "base/android/jni_array.h"
13 #include "base/android/jni_string.h" 13 #include "base/android/jni_string.h"
14 #include "base/android/scoped_java_ref.h" 14 #include "base/android/scoped_java_ref.h"
15 #include "base/feature_list.h" 15 #include "base/feature_list.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "content/browser/frame_host/frame_tree.h" 18 #include "content/browser/frame_host/frame_tree.h"
19 #include "content/browser/frame_host/frame_tree_node.h" 19 #include "content/browser/frame_host/frame_tree_node.h"
20 #include "content/browser/frame_host/render_frame_host_impl.h" 20 #include "content/browser/frame_host/render_frame_host_impl.h"
21 #include "content/browser/renderer_host/render_view_host_delegate.h" 21 #include "content/browser/renderer_host/render_view_host_delegate.h"
22 #include "content/browser/renderer_host/render_view_host_impl.h" 22 #include "content/browser/renderer_host/render_view_host_impl.h"
23 #include "content/browser/renderer_host/render_widget_host_impl.h" 23 #include "content/browser/renderer_host/render_widget_host_impl.h"
24 #include "content/browser/renderer_host/render_widget_host_view_android.h" 24 #include "content/browser/renderer_host/render_widget_host_view_android.h"
25 #include "content/common/frame_messages.h"
26 #include "content/common/input_messages.h" 25 #include "content/common/input_messages.h"
27 #include "content/common/view_messages.h" 26 #include "content/common/view_messages.h"
28 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/native_web_keyboard_event.h" 28 #include "content/public/browser/native_web_keyboard_event.h"
30 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
31 #include "content/public/common/content_features.h" 30 #include "content/public/common/content_features.h"
32 #include "jni/ImeAdapter_jni.h" 31 #include "jni/ImeAdapter_jni.h"
33 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 32 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
34 #include "third_party/WebKit/public/web/WebInputEvent.h" 33 #include "third_party/WebKit/public/web/WebInputEvent.h"
35 #include "third_party/WebKit/public/web/WebTextInputType.h" 34 #include "third_party/WebKit/public/web/WebTextInputType.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 256
258 void ImeAdapterAndroid::SetEditableSelectionOffsets( 257 void ImeAdapterAndroid::SetEditableSelectionOffsets(
259 JNIEnv*, 258 JNIEnv*,
260 const JavaParamRef<jobject>&, 259 const JavaParamRef<jobject>&,
261 int start, 260 int start,
262 int end) { 261 int end) {
263 RenderFrameHost* rfh = GetFocusedFrame(); 262 RenderFrameHost* rfh = GetFocusedFrame();
264 if (!rfh) 263 if (!rfh)
265 return; 264 return;
266 265
267 rfh->Send(new FrameMsg_SetEditableSelectionOffsets(rfh->GetRoutingID(), 266 rfh->Send(new InputMsg_SetEditableSelectionOffsets(rfh->GetRoutingID(), start,
268 start, end)); 267 end));
269 } 268 }
270 269
271 void ImeAdapterAndroid::SetCharacterBounds( 270 void ImeAdapterAndroid::SetCharacterBounds(
272 const std::vector<gfx::RectF>& character_bounds) { 271 const std::vector<gfx::RectF>& character_bounds) {
273 JNIEnv* env = AttachCurrentThread(); 272 JNIEnv* env = AttachCurrentThread();
274 base::android::ScopedJavaLocalRef<jobject> obj = java_ime_adapter_.get(env); 273 base::android::ScopedJavaLocalRef<jobject> obj = java_ime_adapter_.get(env);
275 if (obj.is_null()) 274 if (obj.is_null())
276 return; 275 return;
277 276
278 const size_t coordinates_array_size = character_bounds.size() * 4; 277 const size_t coordinates_array_size = character_bounds.size() * 4;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 365 }
367 366
368 WebContents* ImeAdapterAndroid::GetWebContents() { 367 WebContents* ImeAdapterAndroid::GetWebContents() {
369 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); 368 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl();
370 if (!rwh) 369 if (!rwh)
371 return nullptr; 370 return nullptr;
372 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); 371 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh));
373 } 372 }
374 373
375 } // namespace content 374 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/interstitial_page_impl_browsertest.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698