Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / android / autofill / autofill_popup_view_android.h
blob10f6acd81305e4ee1e95fedf8531ec2ed8af197e
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_
6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_
8 #include <jni.h>
10 #include "base/android/scoped_java_ref.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/ui/autofill/autofill_popup_view.h"
14 namespace gfx {
15 class Rect;
18 namespace autofill {
20 class AutofillPopupController;
22 class AutofillPopupViewAndroid : public AutofillPopupView {
23 public:
24 explicit AutofillPopupViewAndroid(AutofillPopupController* controller);
26 // --------------------------------------------------------------------------
27 // Methods called from Java via JNI
28 // --------------------------------------------------------------------------
29 // Called when an autofill item was selected.
30 void SuggestionSelected(JNIEnv* env, jobject obj, jint list_index);
32 void DeletionRequested(JNIEnv* env, jobject obj, jint list_index);
34 void DeletionConfirmed(JNIEnv* env, jobject obj);
36 void PopupDismissed(JNIEnv* env, jobject obj);
38 static bool RegisterAutofillPopupViewAndroid(JNIEnv* env);
40 protected:
41 // AutofillPopupView implementation.
42 void Show() override;
43 void Hide() override;
44 void InvalidateRow(size_t row) override;
45 void UpdateBoundsAndRedrawPopup() override;
47 private:
48 ~AutofillPopupViewAndroid() override;
50 AutofillPopupController* controller_; // weak.
52 // The index of the last item the user long-pressed (they will be shown a
53 // confirmation dialog).
54 int deleting_index_;
56 // The corresponding java object.
57 base::android::ScopedJavaGlobalRef<jobject> java_object_;
59 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewAndroid);
62 } // namespace autofill
64 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_