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

Side by Side Diff: blimp/client/app/android/web_input_box.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
« no previous file with comments | « blimp/client/app/android/web_input_box.h ('k') | build/android/lint/suppressions.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "blimp/client/app/android/web_input_box.h"
6
7 #include "base/android/jni_string.h"
8 #include "blimp/client/app/android/blimp_client_session_android.h"
9 #include "blimp/client/core/contents/ime_feature.h"
10 #include "jni/WebInputBox_jni.h"
11 #include "ui/base/ime/text_input_type.h"
12
13 using base::android::JavaParamRef;
14
15 namespace blimp {
16 namespace client {
17
18 static jlong Init(JNIEnv* env,
19 const JavaParamRef<jobject>& jobj,
20 const JavaParamRef<jobject>& blimp_client_session) {
21 BlimpClientSession* client_session =
22 BlimpClientSessionAndroid::FromJavaObject(env,
23 blimp_client_session.obj());
24 return reinterpret_cast<intptr_t>(
25 new WebInputBox(env, jobj, client_session->GetImeFeature()));
26 }
27
28 // static
29 bool WebInputBox::RegisterJni(JNIEnv* env) {
30 return RegisterNativesImpl(env);
31 }
32
33 WebInputBox::WebInputBox(JNIEnv* env,
34 const base::android::JavaParamRef<jobject>& jobj,
35 ImeFeature* ime_feature) {
36 java_obj_.Reset(env, jobj);
37 ime_feature_ = ime_feature;
38 ime_feature_->set_delegate(this);
39 }
40
41 WebInputBox::~WebInputBox() {
42 ime_feature_->set_delegate(nullptr);
43 }
44
45 void WebInputBox::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
46 delete this;
47 }
48
49 void WebInputBox::OnShowImeRequested(ui::TextInputType input_type,
50 const std::string& text) {
51 JNIEnv* env = base::android::AttachCurrentThread();
52 DCHECK_NE(ui::TEXT_INPUT_TYPE_NONE, input_type);
53 Java_WebInputBox_onShowImeRequested(
54 env, java_obj_, input_type,
55 base::android::ConvertUTF8ToJavaString(env, text));
56 }
57
58 void WebInputBox::OnHideImeRequested() {
59 JNIEnv* env = base::android::AttachCurrentThread();
60 Java_WebInputBox_onHideImeRequested(env, java_obj_);
61 }
62
63 void WebInputBox::OnImeTextEntered(JNIEnv* env,
64 const JavaParamRef<jobject>& jobj,
65 const JavaParamRef<jstring>& text) {
66 std::string textInput = base::android::ConvertJavaStringToUTF8(env, text);
67 ime_feature_->OnImeTextEntered(textInput);
68 }
69
70 } // namespace client
71 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/app/android/web_input_box.h ('k') | build/android/lint/suppressions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698