| 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_WEB_INPUT_BOX_H_ | 5 #ifndef BLIMP_CLIENT_APP_ANDROID_WEB_INPUT_BOX_H_ |
| 6 #define BLIMP_CLIENT_APP_ANDROID_WEB_INPUT_BOX_H_ | 6 #define BLIMP_CLIENT_APP_ANDROID_WEB_INPUT_BOX_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/feature/web_input_feature.h" |
| 12 | 13 |
| 13 namespace blimp { | 14 namespace blimp { |
| 14 namespace client { | 15 namespace client { |
| 15 | 16 |
| 16 // The native component of org.chromium.blimp.input.WebInputBox. | 17 // The native component of org.chromium.blimp.input.WebInputBox. |
| 17 class WebInputBox { | 18 class WebInputBox : public WebInputFeature::WebInputFeatureDelegate { |
| 18 public: | 19 public: |
| 19 static bool RegisterJni(JNIEnv* env); | 20 static bool RegisterJni(JNIEnv* env); |
| 20 | 21 |
| 21 WebInputBox(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | 22 WebInputBox(JNIEnv* env, |
| 23 const base::android::JavaParamRef<jobject>& jobj, |
| 24 WebInputFeature* web_input_feature); |
| 22 | 25 |
| 23 // Brings up or hides the IME for user to enter text. | 26 // Brings up IME for user to enter text. |
| 24 void OnImeRequested(bool show); | 27 void OnShowImeRequested(int input_type, const std::string& text) override; |
| 28 |
| 29 // Hides IME. |
| 30 void OnHideImeRequested() override; |
| 25 | 31 |
| 26 // Methods called from Java via JNI. | 32 // Methods called from Java via JNI. |
| 27 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | 33 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); |
| 28 | 34 |
| 29 // Sends the text entered from IME to the blimp engine | 35 // Sends the text entered from IME to the blimp engine |
| 30 void OnImeTextEntered(JNIEnv* env, | 36 void OnImeTextEntered(JNIEnv* env, |
| 31 const base::android::JavaParamRef<jobject>& jobj, | 37 const base::android::JavaParamRef<jobject>& jobj, |
| 32 const base::android::JavaParamRef<jstring>& text); | 38 const base::android::JavaParamRef<jstring>& text); |
| 33 | 39 |
| 34 private: | 40 private: |
| 35 virtual ~WebInputBox(); | 41 virtual ~WebInputBox(); |
| 36 | 42 |
| 37 // Reference to the Java object which owns this class. | 43 // Reference to the Java object which owns this class. |
| 38 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 44 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 39 | 45 |
| 46 // A bridge to the network layer which does the work of (de)serializing the |
| 47 // outgoing and incoming BlimpMessage::IME messages from the engine. |
| 48 WebInputFeature* web_input_feature_; |
| 49 |
| 40 DISALLOW_COPY_AND_ASSIGN(WebInputBox); | 50 DISALLOW_COPY_AND_ASSIGN(WebInputBox); |
| 41 }; | 51 }; |
| 42 | 52 |
| 43 } // namespace client | 53 } // namespace client |
| 44 } // namespace blimp | 54 } // namespace blimp |
| 45 | 55 |
| 46 #endif // BLIMP_CLIENT_APP_ANDROID_WEB_INPUT_BOX_H_ | 56 #endif // BLIMP_CLIENT_APP_ANDROID_WEB_INPUT_BOX_H_ |
| OLD | NEW |