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

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

Issue 10911012: Upstream Android IME support (ImeAdapter). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nits fixed; recent downstream changes applied; ime adapter added to browser_jni_registrar Created 8 years, 3 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/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 // Add the item to the list 470 // Add the item to the list
471 Java_ContentViewCore_addToNavigationHistory(env, obj, context, j_url.obj(), 471 Java_ContentViewCore_addToNavigationHistory(env, obj, context, j_url.obj(),
472 j_virtual_url.obj(), j_original_url.obj(), j_title.obj(), 472 j_virtual_url.obj(), j_original_url.obj(), j_title.obj(),
473 j_bitmap.obj()); 473 j_bitmap.obj());
474 } 474 }
475 475
476 return controller.GetCurrentEntryIndex(); 476 return controller.GetCurrentEntryIndex();
477 } 477 }
478 478
479 int ContentViewCoreImpl::GetNativeImeAdapter(JNIEnv* env, jobject obj) {
480 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
481 if (!rwhva)
482 return 0;
483 return rwhva->GetNativeImeAdapter();
484 }
485
479 // -------------------------------------------------------------------------- 486 // --------------------------------------------------------------------------
480 // Methods called from native code 487 // Methods called from native code
481 // -------------------------------------------------------------------------- 488 // --------------------------------------------------------------------------
482 489
483 void ContentViewCoreImpl::LoadUrl( 490 void ContentViewCoreImpl::LoadUrl(
484 NavigationController::LoadURLParams& params) { 491 NavigationController::LoadURLParams& params) {
485 web_contents()->GetController().LoadURLWithParams(params); 492 web_contents()->GetController().LoadURLWithParams(params);
486 PostLoadUrl(params.url); 493 PostLoadUrl(params.url);
487 } 494 }
488 495
(...skipping 21 matching lines...) Expand all
510 } 517 }
511 518
512 // -------------------------------------------------------------------------- 519 // --------------------------------------------------------------------------
513 // Public methods that call to Java via JNI 520 // Public methods that call to Java via JNI
514 // -------------------------------------------------------------------------- 521 // --------------------------------------------------------------------------
515 522
516 void ContentViewCoreImpl::OnTabCrashed(const base::ProcessHandle handle) { 523 void ContentViewCoreImpl::OnTabCrashed(const base::ProcessHandle handle) {
517 NOTIMPLEMENTED() << "not upstreamed yet"; 524 NOTIMPLEMENTED() << "not upstreamed yet";
518 } 525 }
519 526
527 void ContentViewCoreImpl::ImeUpdateAdapter(int native_ime_adapter,
528 int text_input_type,
529 const std::string& text,
530 int selection_start,
531 int selection_end,
532 int composition_start,
533 int composition_end,
534 bool show_ime_if_needed) {
535 JNIEnv* env = AttachCurrentThread();
536 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
537 if (obj.is_null())
538 return;
539
540 ScopedJavaLocalRef<jstring> jstring_text = ConvertUTF8ToJavaString(env, text);
541 Java_ContentViewCore_imeUpdateAdapter(env, obj.obj(),
542 native_ime_adapter, text_input_type,
543 jstring_text.obj(),
544 selection_start, selection_end,
545 composition_start, composition_end,
546 show_ime_if_needed);
547 }
548
520 void ContentViewCoreImpl::SetTitle(const string16& title) { 549 void ContentViewCoreImpl::SetTitle(const string16& title) {
521 NOTIMPLEMENTED() << "not upstreamed yet"; 550 NOTIMPLEMENTED() << "not upstreamed yet";
522 } 551 }
523 552
524 void ContentViewCoreImpl::ShowSelectPopupMenu( 553 void ContentViewCoreImpl::ShowSelectPopupMenu(
525 const std::vector<WebMenuItem>& items, int selected_item, bool multiple) { 554 const std::vector<WebMenuItem>& items, int selected_item, bool multiple) {
526 JNIEnv* env = AttachCurrentThread(); 555 JNIEnv* env = AttachCurrentThread();
527 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 556 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
528 if (j_obj.is_null()) 557 if (j_obj.is_null())
529 return; 558 return;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { 674 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) {
646 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; 675 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!";
647 return false; 676 return false;
648 } 677 }
649 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); 678 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I");
650 679
651 return RegisterNativesImpl(env) >= 0; 680 return RegisterNativesImpl(env) >= 0;
652 } 681 }
653 682
654 } // namespace content 683 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/ime_adapter_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698