OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/core/contents/android/ime_helper_dialog.h" | 5 #include "blimp/client/core/contents/android/ime_helper_dialog.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "jni/ImeHelperDialog_jni.h" | 9 #include "jni/ImeHelperDialog_jni.h" |
10 #include "ui/android/window_android.h" | 10 #include "ui/android/window_android.h" |
11 | 11 |
12 using base::android::JavaParamRef; | |
13 | |
14 namespace blimp { | 12 namespace blimp { |
15 namespace client { | 13 namespace client { |
16 | 14 |
17 // static | 15 // static |
18 bool ImeHelperDialog::RegisterJni(JNIEnv* env) { | 16 bool ImeHelperDialog::RegisterJni(JNIEnv* env) { |
19 return RegisterNativesImpl(env); | 17 return RegisterNativesImpl(env); |
20 } | 18 } |
21 | 19 |
22 ImeHelperDialog::ImeHelperDialog(ui::WindowAndroid* window) { | 20 ImeHelperDialog::ImeHelperDialog(ui::WindowAndroid* window) { |
23 JNIEnv* env = base::android::AttachCurrentThread(); | 21 JNIEnv* env = base::android::AttachCurrentThread(); |
(...skipping 17 matching lines...) Expand all Loading... |
41 Java_ImeHelperDialog_onShowImeRequested( | 39 Java_ImeHelperDialog_onShowImeRequested( |
42 env, java_obj_, input_type, | 40 env, java_obj_, input_type, |
43 base::android::ConvertUTF8ToJavaString(env, text)); | 41 base::android::ConvertUTF8ToJavaString(env, text)); |
44 } | 42 } |
45 | 43 |
46 void ImeHelperDialog::OnHideImeRequested() { | 44 void ImeHelperDialog::OnHideImeRequested() { |
47 JNIEnv* env = base::android::AttachCurrentThread(); | 45 JNIEnv* env = base::android::AttachCurrentThread(); |
48 Java_ImeHelperDialog_onHideImeRequested(env, java_obj_); | 46 Java_ImeHelperDialog_onHideImeRequested(env, java_obj_); |
49 } | 47 } |
50 | 48 |
51 void ImeHelperDialog::OnImeTextEntered(JNIEnv* env, | 49 void ImeHelperDialog::OnImeTextEntered( |
52 const JavaParamRef<jobject>& jobj, | 50 JNIEnv* env, |
53 const JavaParamRef<jstring>& text) { | 51 const base::android::JavaParamRef<jobject>& jobj, |
| 52 const base::android::JavaParamRef<jstring>& text) { |
54 std::string text_input = base::android::ConvertJavaStringToUTF8(env, text); | 53 std::string text_input = base::android::ConvertJavaStringToUTF8(env, text); |
55 base::ResetAndReturn(&text_submit_callback_).Run(text_input); | 54 base::ResetAndReturn(&text_submit_callback_).Run(text_input); |
56 } | 55 } |
57 | 56 |
58 } // namespace client | 57 } // namespace client |
59 } // namespace blimp | 58 } // namespace blimp |
OLD | NEW |