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

Unified Diff: blimp/client/core/contents/android/ime_helper_dialog.cc

Issue 2292343002: Hooking up Blimp IME with BlimpContents (Closed)
Patch Set: Using Callback Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/contents/android/ime_helper_dialog.cc
diff --git a/blimp/client/app/android/ime_helper_dialog.cc b/blimp/client/core/contents/android/ime_helper_dialog.cc
similarity index 55%
copy from blimp/client/app/android/ime_helper_dialog.cc
copy to blimp/client/core/contents/android/ime_helper_dialog.cc
index 698424789b6b109c6944a7759831dcc7f03bf995..53c42d4744676eb66c78de5a200d4f71692d0372 100644
--- a/blimp/client/app/android/ime_helper_dialog.cc
+++ b/blimp/client/core/contents/android/ime_helper_dialog.cc
@@ -2,53 +2,38 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "blimp/client/app/android/ime_helper_dialog.h"
+#include "blimp/client/core/contents/android/ime_helper_dialog.h"
#include "base/android/jni_string.h"
-#include "blimp/client/app/android/blimp_client_session_android.h"
-#include "blimp/client/core/contents/ime_feature.h"
#include "jni/ImeHelperDialog_jni.h"
-#include "ui/base/ime/text_input_type.h"
+#include "ui/android/window_android.h"
using base::android::JavaParamRef;
namespace blimp {
namespace client {
-static jlong Init(JNIEnv* env,
- const JavaParamRef<jobject>& jobj,
- const JavaParamRef<jobject>& blimp_client_session) {
- BlimpClientSession* client_session =
- BlimpClientSessionAndroid::FromJavaObject(env,
- blimp_client_session.obj());
- return reinterpret_cast<intptr_t>(
- new ImeHelperDialog(env, jobj, client_session->GetImeFeature()));
-}
-
// static
bool ImeHelperDialog::RegisterJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}
-ImeHelperDialog::ImeHelperDialog(
- JNIEnv* env,
- const base::android::JavaParamRef<jobject>& jobj,
- ImeFeature* ime_feature) {
- java_obj_.Reset(env, jobj);
- ime_feature_ = ime_feature;
- ime_feature_->set_delegate(this);
+ImeHelperDialog::ImeHelperDialog(ui::WindowAndroid* window) {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ java_obj_.Reset(Java_ImeHelperDialog_create(
+ env, reinterpret_cast<intptr_t>(this), window->GetJavaObject()));
}
ImeHelperDialog::~ImeHelperDialog() {
- ime_feature_->set_delegate(nullptr);
-}
-
-void ImeHelperDialog::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
- delete this;
+ Java_ImeHelperDialog_clearNativePtr(base::android::AttachCurrentThread(),
+ java_obj_);
}
void ImeHelperDialog::OnShowImeRequested(ui::TextInputType input_type,
- const std::string& text) {
+ const std::string& text,
+ const ShowImeCallback& callback) {
+ textSubmitCallback_ = callback;
+
JNIEnv* env = base::android::AttachCurrentThread();
DCHECK_NE(ui::TEXT_INPUT_TYPE_NONE, input_type);
Java_ImeHelperDialog_onShowImeRequested(
@@ -65,7 +50,7 @@ void ImeHelperDialog::OnImeTextEntered(JNIEnv* env,
const JavaParamRef<jobject>& jobj,
const JavaParamRef<jstring>& text) {
std::string textInput = base::android::ConvertJavaStringToUTF8(env, text);
- ime_feature_->OnImeTextEntered(textInput);
+ textSubmitCallback_.Run(textInput);
David Trainor- moved to gerrit 2016/08/31 05:59:09 Drop the callback after calling it?
shaktisahu 2016/08/31 17:28:21 Done.
}
} // namespace client

Powered by Google App Engine
This is Rietveld 408576698