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

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

Issue 2832153002: Ensure ime adapter gets connected to RWHVA (Closed)
Patch Set: comment Created 3 years, 8 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
« no previous file with comments | « no previous file | content/browser/android/render_widget_host_connector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/android/ime_adapter_android.h" 5 #include "content/browser/android/ime_adapter_android.h"
6 6
7 #include <android/input.h> 7 #include <android/input.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 bool RegisterImeAdapter(JNIEnv* env) { 64 bool RegisterImeAdapter(JNIEnv* env) {
65 return RegisterNativesImpl(env); 65 return RegisterNativesImpl(env);
66 } 66 }
67 67
68 jlong Init(JNIEnv* env, 68 jlong Init(JNIEnv* env,
69 const JavaParamRef<jobject>& obj, 69 const JavaParamRef<jobject>& obj,
70 const JavaParamRef<jobject>& jweb_contents) { 70 const JavaParamRef<jobject>& jweb_contents) {
71 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents); 71 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents);
72 DCHECK(web_contents); 72 DCHECK(web_contents);
73 return reinterpret_cast<intptr_t>( 73 auto* ime_adapter = new ImeAdapterAndroid(env, obj, web_contents);
74 new ImeAdapterAndroid(env, obj, web_contents)); 74 ime_adapter->Initialize();
75 return reinterpret_cast<intptr_t>(ime_adapter);
75 } 76 }
76 77
77 // Callback from Java to convert BackgroundColorSpan data to a 78 // Callback from Java to convert BackgroundColorSpan data to a
78 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|. 79 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|.
79 void AppendBackgroundColorSpan(JNIEnv*, 80 void AppendBackgroundColorSpan(JNIEnv*,
80 const JavaParamRef<jclass>&, 81 const JavaParamRef<jclass>&,
81 jlong underlines_ptr, 82 jlong underlines_ptr,
82 jint start, 83 jint start,
83 jint end, 84 jint end,
84 jint background_color) { 85 jint background_color) {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 Java_ImeAdapter_populateUnderlinesFromSpans( 388 Java_ImeAdapter_populateUnderlinesFromSpans(
388 env, obj, text, reinterpret_cast<jlong>(&underlines)); 389 env, obj, text, reinterpret_cast<jlong>(&underlines));
389 390
390 // Sort spans by |.startOffset|. 391 // Sort spans by |.startOffset|.
391 std::sort(underlines.begin(), underlines.end()); 392 std::sort(underlines.begin(), underlines.end());
392 393
393 return underlines; 394 return underlines;
394 } 395 }
395 396
396 } // namespace content 397 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/render_widget_host_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698