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

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

Issue 2938123002: Revert of [Android] Adding Smart GO/NEXT feature in Chrome (Closed)
Patch Set: Created 3 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
« no previous file with comments | « content/browser/android/ime_adapter_android.h ('k') | content/common/frame_messages.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
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/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "content/browser/frame_host/render_frame_host_impl.h" 17 #include "content/browser/frame_host/render_frame_host_impl.h"
18 #include "content/browser/renderer_host/render_view_host_delegate.h" 18 #include "content/browser/renderer_host/render_view_host_delegate.h"
19 #include "content/browser/renderer_host/render_widget_host_impl.h" 19 #include "content/browser/renderer_host/render_widget_host_impl.h"
20 #include "content/browser/renderer_host/render_widget_host_view_android.h" 20 #include "content/browser/renderer_host/render_widget_host_view_android.h"
21 #include "content/common/frame_messages.h"
22 #include "content/common/input_messages.h" 21 #include "content/common/input_messages.h"
23 #include "content/common/view_messages.h" 22 #include "content/common/view_messages.h"
24 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/native_web_keyboard_event.h" 24 #include "content/public/browser/native_web_keyboard_event.h"
26 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
27 #include "jni/ImeAdapter_jni.h" 26 #include "jni/ImeAdapter_jni.h"
28 #include "third_party/WebKit/public/platform/WebInputEvent.h" 27 #include "third_party/WebKit/public/platform/WebInputEvent.h"
29 #include "third_party/WebKit/public/platform/WebTextInputType.h" 28 #include "third_party/WebKit/public/platform/WebTextInputType.h"
30 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 29 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
31 30
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 277 }
279 278
280 void ImeAdapterAndroid::FocusedNodeChanged(bool is_editable_node) { 279 void ImeAdapterAndroid::FocusedNodeChanged(bool is_editable_node) {
281 JNIEnv* env = AttachCurrentThread(); 280 JNIEnv* env = AttachCurrentThread();
282 ScopedJavaLocalRef<jobject> obj = java_ime_adapter_.get(env); 281 ScopedJavaLocalRef<jobject> obj = java_ime_adapter_.get(env);
283 if (!obj.is_null()) { 282 if (!obj.is_null()) {
284 Java_ImeAdapter_focusedNodeChanged(env, obj, is_editable_node); 283 Java_ImeAdapter_focusedNodeChanged(env, obj, is_editable_node);
285 } 284 }
286 } 285 }
287 286
288 void ImeAdapterAndroid::AdvanceFocusInForm(JNIEnv* env,
289 const JavaParamRef<jobject>& obj,
290 jint focus_type) {
291 RenderFrameHost* rfh = GetFocusedFrame();
292 if (!rfh)
293 return;
294
295 rfh->Send(new FrameMsg_AdvanceFocusInForm(
296 rfh->GetRoutingID(), static_cast<blink::WebFocusType>(focus_type)));
297 }
298
299 void ImeAdapterAndroid::SetEditableSelectionOffsets( 287 void ImeAdapterAndroid::SetEditableSelectionOffsets(
300 JNIEnv*, 288 JNIEnv*,
301 const JavaParamRef<jobject>&, 289 const JavaParamRef<jobject>&,
302 int start, 290 int start,
303 int end) { 291 int end) {
304 RenderFrameHost* rfh = GetFocusedFrame(); 292 RenderFrameHost* rfh = GetFocusedFrame();
305 if (!rfh) 293 if (!rfh)
306 return; 294 return;
307 295
308 rfh->GetFrameInputHandler()->SetEditableSelectionOffsets(start, end); 296 rfh->GetFrameInputHandler()->SetEditableSelectionOffsets(start, end);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 Java_ImeAdapter_populateUnderlinesFromSpans( 416 Java_ImeAdapter_populateUnderlinesFromSpans(
429 env, obj, text, reinterpret_cast<jlong>(&underlines)); 417 env, obj, text, reinterpret_cast<jlong>(&underlines));
430 418
431 // Sort spans by |.startOffset|. 419 // Sort spans by |.startOffset|.
432 std::sort(underlines.begin(), underlines.end()); 420 std::sort(underlines.begin(), underlines.end());
433 421
434 return underlines; 422 return underlines;
435 } 423 }
436 424
437 } // namespace content 425 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/ime_adapter_android.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698