| 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_CORE_CONTENTS_ANDROID_IME_HELPER_DIALOG_H_ |
| 6 #define BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ | 6 #define BLIMP_CLIENT_CORE_CONTENTS_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 ui { |
| 16 class WindowAndroid; |
| 17 } // namespace ui |
| 18 |
| 15 namespace blimp { | 19 namespace blimp { |
| 16 namespace client { | 20 namespace client { |
| 17 | 21 |
| 18 // The native component of org.chromium.blimp.input.ImeHelperDialog. | 22 // The native component of |
| 23 // org.chromium.blimp.core.contents.input.ImeHelperDialog |
| 19 class ImeHelperDialog : public ImeFeature::Delegate { | 24 class ImeHelperDialog : public ImeFeature::Delegate { |
| 20 public: | 25 public: |
| 21 static bool RegisterJni(JNIEnv* env); | 26 static bool RegisterJni(JNIEnv* env); |
| 22 | 27 |
| 23 // |ime_feature| is expected to outlive the ImeHelperDialog. | 28 explicit ImeHelperDialog(ui::WindowAndroid* window); |
| 24 ImeHelperDialog(JNIEnv* env, | 29 ~ImeHelperDialog() override; |
| 25 const base::android::JavaParamRef<jobject>& jobj, | |
| 26 ImeFeature* ime_feature); | |
| 27 | 30 |
| 28 // Brings up IME for user to enter text. | 31 // ImeFeature::Delegate implementation. |
| 29 void OnShowImeRequested(ui::TextInputType input_type, | 32 void OnShowImeRequested(ui::TextInputType input_type, |
| 30 const std::string& text) override; | 33 const std::string& text, |
| 31 | 34 const ImeFeature::ShowImeCallback& callback) override; |
| 32 // Hides IME. | |
| 33 void OnHideImeRequested() override; | 35 void OnHideImeRequested() override; |
| 34 | 36 |
| 35 // Methods called from Java via JNI. | |
| 36 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | |
| 37 | |
| 38 // Sends the text entered from IME to the blimp engine. | 37 // Sends the text entered from IME to the blimp engine. |
| 39 void OnImeTextEntered(JNIEnv* env, | 38 void OnImeTextEntered(JNIEnv* env, |
| 40 const base::android::JavaParamRef<jobject>& jobj, | 39 const base::android::JavaParamRef<jobject>& jobj, |
| 41 const base::android::JavaParamRef<jstring>& text); | 40 const base::android::JavaParamRef<jstring>& text); |
| 42 | 41 |
| 43 private: | 42 private: |
| 44 ~ImeHelperDialog() override; | |
| 45 | |
| 46 // Reference to the Java object which owns this class. | |
| 47 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 43 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 48 | 44 |
| 49 // A bridge to the network layer which does the work of (de)serializing the | 45 // A callback for the current request to be executed on text submission from |
| 50 // outgoing and incoming BlimpMessage::IME messages from the engine. | 46 // the user. |
| 51 ImeFeature* ime_feature_; | 47 ImeFeature::ShowImeCallback text_submit_callback_; |
| 52 | 48 |
| 53 DISALLOW_COPY_AND_ASSIGN(ImeHelperDialog); | 49 DISALLOW_COPY_AND_ASSIGN(ImeHelperDialog); |
| 54 }; | 50 }; |
| 55 | 51 |
| 56 } // namespace client | 52 } // namespace client |
| 57 } // namespace blimp | 53 } // namespace blimp |
| 58 | 54 #endif // BLIMP_CLIENT_CORE_CONTENTS_ANDROID_IME_HELPER_DIALOG_H_ |
| 59 #endif // BLIMP_CLIENT_APP_ANDROID_IME_HELPER_DIALOG_H_ | |
| OLD | NEW |