Chromium Code Reviews| 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 #ifndef BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ | 5 #ifndef BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ |
| 6 #define BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ | 6 #define BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "blimp/client/core/contents/ime_feature.h" | 12 #include "blimp/client/core/contents/ime_feature.h" |
| 13 #include "ui/base/ime/text_input_type.h" | 13 #include "ui/base/ime/text_input_type.h" |
| 14 | 14 |
| 15 namespace blimp { | 15 namespace blimp { |
| 16 namespace client { | 16 namespace client { |
| 17 namespace app { | |
| 17 | 18 |
| 18 // The native component of org.chromium.blimp.input.ImeHelperDialog. | 19 // The native component of org.chromium.blimp.input.ImeHelperDialog. |
| 19 class ImeHelperDialog : public ImeFeature::Delegate { | 20 class ImeHelperDialog : public ImeFeature::Delegate { |
|
David Trainor- moved to gerrit
2016/08/31 05:59:09
Do we need two versions of this class? Are they d
shaktisahu
2016/08/31 17:28:21
Not a lot though. The app version is driven by Jav
| |
| 20 public: | 21 public: |
| 21 static bool RegisterJni(JNIEnv* env); | 22 static bool RegisterJni(JNIEnv* env); |
| 22 | 23 |
| 23 // |ime_feature| is expected to outlive the ImeHelperDialog. | 24 // |ime_feature| is expected to outlive the ImeHelperDialog. |
| 24 ImeHelperDialog(JNIEnv* env, | 25 ImeHelperDialog(JNIEnv* env, |
| 25 const base::android::JavaParamRef<jobject>& jobj, | 26 const base::android::JavaParamRef<jobject>& jobj, |
| 26 ImeFeature* ime_feature); | 27 ImeFeature* ime_feature); |
| 27 | 28 |
| 28 // Brings up IME for user to enter text. | 29 // Brings up IME for user to enter text. |
| 29 void OnShowImeRequested(ui::TextInputType input_type, | 30 void OnShowImeRequested(ui::TextInputType input_type, |
| 30 const std::string& text) override; | 31 const std::string& text, |
| 32 const ShowImeCallback& callback) override; | |
| 31 | 33 |
| 32 // Hides IME. | 34 // Hides IME. |
| 33 void OnHideImeRequested() override; | 35 void OnHideImeRequested() override; |
| 34 | 36 |
| 35 // Methods called from Java via JNI. | 37 // Methods called from Java via JNI. |
| 36 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | 38 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); |
| 37 | 39 |
| 38 // Sends the text entered from IME to the blimp engine. | 40 // Sends the text entered from IME to the blimp engine. |
| 39 void OnImeTextEntered(JNIEnv* env, | 41 void OnImeTextEntered(JNIEnv* env, |
| 40 const base::android::JavaParamRef<jobject>& jobj, | 42 const base::android::JavaParamRef<jobject>& jobj, |
| 41 const base::android::JavaParamRef<jstring>& text); | 43 const base::android::JavaParamRef<jstring>& text); |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 ~ImeHelperDialog() override; | 46 ~ImeHelperDialog() override; |
| 45 | 47 |
| 46 // Reference to the Java object which owns this class. | 48 // Reference to the Java object which owns this class. |
| 47 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 49 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 48 | 50 |
| 49 // A bridge to the network layer which does the work of (de)serializing the | 51 // A bridge to the network layer which does the work of (de)serializing the |
| 50 // outgoing and incoming BlimpMessage::IME messages from the engine. | 52 // outgoing and incoming BlimpMessage::IME messages from the engine. |
| 51 ImeFeature* ime_feature_; | 53 ImeFeature* ime_feature_; |
| 52 | 54 |
| 55 // A callback to be executed on text submission from the user. | |
| 56 ShowImeCallback textSubmitCallback_; | |
|
David Trainor- moved to gerrit
2016/08/31 05:59:09
text_submit_callback_. Could we also mention that
shaktisahu
2016/08/31 17:28:21
Done.
| |
| 57 | |
| 53 DISALLOW_COPY_AND_ASSIGN(ImeHelperDialog); | 58 DISALLOW_COPY_AND_ASSIGN(ImeHelperDialog); |
| 54 }; | 59 }; |
| 55 | 60 |
| 61 } // namespace app | |
| 56 } // namespace client | 62 } // namespace client |
| 57 } // namespace blimp | 63 } // namespace blimp |
| 58 | 64 |
| 59 #endif // BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ | 65 #endif // BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ |
| OLD | NEW |