| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 12 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace autofill { | 18 namespace autofill { |
| 19 | 19 |
| 20 class AutofillPopupController; | 20 class AutofillPopupController; |
| 21 | 21 |
| 22 class AutofillPopupViewAndroid : public AutofillPopupView { | 22 class AutofillPopupViewAndroid : public AutofillPopupView { |
| 23 public: | 23 public: |
| 24 explicit AutofillPopupViewAndroid(AutofillPopupController* controller); | 24 explicit AutofillPopupViewAndroid(AutofillPopupController* controller); |
| 25 | 25 |
| 26 // -------------------------------------------------------------------------- | 26 // -------------------------------------------------------------------------- |
| 27 // Methods called from Java via JNI | 27 // Methods called from Java via JNI |
| 28 // -------------------------------------------------------------------------- | 28 // -------------------------------------------------------------------------- |
| 29 // Called when an autofill item was selected. | 29 // Called when an autofill item was selected. |
| 30 void SuggestionSelected(JNIEnv* env, jobject obj, jint list_index); | 30 void SuggestionSelected(JNIEnv* env, |
| 31 const base::android::JavaParamRef<jobject>& obj, |
| 32 jint list_index); |
| 31 | 33 |
| 32 void DeletionRequested(JNIEnv* env, jobject obj, jint list_index); | 34 void DeletionRequested(JNIEnv* env, |
| 35 const base::android::JavaParamRef<jobject>& obj, |
| 36 jint list_index); |
| 33 | 37 |
| 34 void DeletionConfirmed(JNIEnv* env, jobject obj); | 38 void DeletionConfirmed(JNIEnv* env, |
| 39 const base::android::JavaParamRef<jobject>& obj); |
| 35 | 40 |
| 36 void PopupDismissed(JNIEnv* env, jobject obj); | 41 void PopupDismissed(JNIEnv* env, |
| 42 const base::android::JavaParamRef<jobject>& obj); |
| 37 | 43 |
| 38 static bool RegisterAutofillPopupViewAndroid(JNIEnv* env); | 44 static bool RegisterAutofillPopupViewAndroid(JNIEnv* env); |
| 39 | 45 |
| 40 protected: | 46 protected: |
| 41 // AutofillPopupView implementation. | 47 // AutofillPopupView implementation. |
| 42 void Show() override; | 48 void Show() override; |
| 43 void Hide() override; | 49 void Hide() override; |
| 44 void InvalidateRow(size_t row) override; | 50 void InvalidateRow(size_t row) override; |
| 45 void UpdateBoundsAndRedrawPopup() override; | 51 void UpdateBoundsAndRedrawPopup() override; |
| 46 | 52 |
| 47 private: | 53 private: |
| 48 ~AutofillPopupViewAndroid() override; | 54 ~AutofillPopupViewAndroid() override; |
| 49 | 55 |
| 50 AutofillPopupController* controller_; // weak. | 56 AutofillPopupController* controller_; // weak. |
| 51 | 57 |
| 52 // The index of the last item the user long-pressed (they will be shown a | 58 // The index of the last item the user long-pressed (they will be shown a |
| 53 // confirmation dialog). | 59 // confirmation dialog). |
| 54 int deleting_index_; | 60 int deleting_index_; |
| 55 | 61 |
| 56 // The corresponding java object. | 62 // The corresponding java object. |
| 57 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 63 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| 58 | 64 |
| 59 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewAndroid); | 65 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewAndroid); |
| 60 }; | 66 }; |
| 61 | 67 |
| 62 } // namespace autofill | 68 } // namespace autofill |
| 63 | 69 |
| 64 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ | 70 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ |
| OLD | NEW |