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

Side by Side Diff: blimp/client/app/android/ime_helper_dialog.cc

Issue 2261853002: Changed Blimp IME to use PopUp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ime_popup
Patch Set: Used AlertDialog from support.v7 Created 4 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 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/app/android/web_input_box.h" 5 #include "blimp/client/app/android/ime_helper_dialog.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "blimp/client/app/android/blimp_client_session_android.h" 8 #include "blimp/client/app/android/blimp_client_session_android.h"
9 #include "blimp/client/core/contents/ime_feature.h" 9 #include "blimp/client/core/contents/ime_feature.h"
10 #include "jni/WebInputBox_jni.h" 10 #include "jni/ImeHelperDialog_jni.h"
11 #include "ui/base/ime/text_input_type.h" 11 #include "ui/base/ime/text_input_type.h"
12 12
13 using base::android::JavaParamRef; 13 using base::android::JavaParamRef;
14 14
15 namespace blimp { 15 namespace blimp {
16 namespace client { 16 namespace client {
17 17
18 static jlong Init(JNIEnv* env, 18 static jlong Init(JNIEnv* env,
19 const JavaParamRef<jobject>& jobj, 19 const JavaParamRef<jobject>& jobj,
20 const JavaParamRef<jobject>& blimp_client_session) { 20 const JavaParamRef<jobject>& blimp_client_session) {
21 BlimpClientSession* client_session = 21 BlimpClientSession* client_session =
22 BlimpClientSessionAndroid::FromJavaObject(env, 22 BlimpClientSessionAndroid::FromJavaObject(env,
23 blimp_client_session.obj()); 23 blimp_client_session.obj());
24 return reinterpret_cast<intptr_t>( 24 return reinterpret_cast<intptr_t>(
25 new WebInputBox(env, jobj, client_session->GetImeFeature())); 25 new ImeHelperDialog(env, jobj, client_session->GetImeFeature()));
26 } 26 }
27 27
28 // static 28 // static
29 bool WebInputBox::RegisterJni(JNIEnv* env) { 29 bool ImeHelperDialog::RegisterJni(JNIEnv* env) {
30 return RegisterNativesImpl(env); 30 return RegisterNativesImpl(env);
31 } 31 }
32 32
33 WebInputBox::WebInputBox(JNIEnv* env, 33 ImeHelperDialog::ImeHelperDialog(
34 const base::android::JavaParamRef<jobject>& jobj, 34 JNIEnv* env,
35 ImeFeature* ime_feature) { 35 const base::android::JavaParamRef<jobject>& jobj,
36 ImeFeature* ime_feature) {
36 java_obj_.Reset(env, jobj); 37 java_obj_.Reset(env, jobj);
37 ime_feature_ = ime_feature; 38 ime_feature_ = ime_feature;
38 ime_feature_->set_delegate(this); 39 ime_feature_->set_delegate(this);
39 } 40 }
40 41
41 WebInputBox::~WebInputBox() { 42 ImeHelperDialog::~ImeHelperDialog() {
42 ime_feature_->set_delegate(nullptr); 43 ime_feature_->set_delegate(nullptr);
43 } 44 }
44 45
45 void WebInputBox::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { 46 void ImeHelperDialog::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
46 delete this; 47 delete this;
47 } 48 }
48 49
49 void WebInputBox::OnShowImeRequested(ui::TextInputType input_type, 50 void ImeHelperDialog::OnShowImeRequested(ui::TextInputType input_type,
50 const std::string& text) { 51 const std::string& text) {
51 JNIEnv* env = base::android::AttachCurrentThread(); 52 JNIEnv* env = base::android::AttachCurrentThread();
52 DCHECK_NE(ui::TEXT_INPUT_TYPE_NONE, input_type); 53 DCHECK_NE(ui::TEXT_INPUT_TYPE_NONE, input_type);
53 Java_WebInputBox_onShowImeRequested( 54 Java_ImeHelperDialog_onShowImeRequested(
54 env, java_obj_, input_type, 55 env, java_obj_, input_type,
55 base::android::ConvertUTF8ToJavaString(env, text)); 56 base::android::ConvertUTF8ToJavaString(env, text));
56 } 57 }
57 58
58 void WebInputBox::OnHideImeRequested() { 59 void ImeHelperDialog::OnHideImeRequested() {
59 JNIEnv* env = base::android::AttachCurrentThread(); 60 JNIEnv* env = base::android::AttachCurrentThread();
60 Java_WebInputBox_onHideImeRequested(env, java_obj_); 61 Java_ImeHelperDialog_onHideImeRequested(env, java_obj_);
61 } 62 }
62 63
63 void WebInputBox::OnImeTextEntered(JNIEnv* env, 64 void ImeHelperDialog::OnImeTextEntered(JNIEnv* env,
64 const JavaParamRef<jobject>& jobj, 65 const JavaParamRef<jobject>& jobj,
65 const JavaParamRef<jstring>& text) { 66 const JavaParamRef<jstring>& text) {
66 std::string textInput = base::android::ConvertJavaStringToUTF8(env, text); 67 std::string textInput = base::android::ConvertJavaStringToUTF8(env, text);
67 ime_feature_->OnImeTextEntered(textInput); 68 ime_feature_->OnImeTextEntered(textInput);
68 } 69 }
69 70
70 } // namespace client 71 } // namespace client
71 } // namespace blimp 72 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/app/android/ime_helper_dialog.h ('k') | blimp/client/app/android/java/res/layout/blimp_main.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698