Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / android / autofill / autofill_keyboard_accessory_view.h
blob779b43b4a1dcfc804dbee3ab3b5fd0e47c7f107d
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_KEYBOARD_ACCESSORY_VIEW_H_
6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H_
8 #include <jni.h>
9 #include <vector>
11 #include "base/android/scoped_java_ref.h"
12 #include "base/compiler_specific.h"
13 #include "chrome/browser/ui/autofill/autofill_popup_view.h"
15 namespace gfx {
16 class Rect;
19 namespace autofill {
21 class AutofillPopupController;
23 // A suggestion view that acts as an alternative to the field-attached popup
24 // window. This view appears above the keyboard and spans the width of the
25 // screen, condensing rather than overlaying the content area. Enable via
26 // --enable-autofill-keyboard-accessory-view.
27 class AutofillKeyboardAccessoryView : public AutofillPopupView {
28 public:
29 explicit AutofillKeyboardAccessoryView(AutofillPopupController* controller);
31 // --------------------------------------------------------------------------
32 // Methods called from Java via JNI
33 // --------------------------------------------------------------------------
34 // Called when an autofill item was selected.
35 void SuggestionSelected(JNIEnv* env, jobject obj, jint list_index);
37 void DeletionRequested(JNIEnv* env, jobject obj, jint list_index);
39 void DeletionConfirmed(JNIEnv* env, jobject obj);
41 void ViewDismissed(JNIEnv* env, jobject obj);
43 static bool RegisterAutofillKeyboardAccessoryView(JNIEnv* env);
45 protected:
46 // AutofillPopupView implementation.
47 void Show() override;
48 void Hide() override;
49 void InvalidateRow(size_t row) override;
50 void UpdateBoundsAndRedrawPopup() override;
52 private:
53 ~AutofillKeyboardAccessoryView() override;
55 AutofillPopupController* controller_; // weak.
57 // The index of the last item the user long-pressed (they will be shown a
58 // confirmation dialog).
59 int deleting_index_;
61 // Mapping from Java list index to autofill suggestion index.
62 std::vector<int> positions_;
64 // The corresponding java object.
65 base::android::ScopedJavaGlobalRef<jobject> java_object_;
67 DISALLOW_COPY_AND_ASSIGN(AutofillKeyboardAccessoryView);
70 } // namespace autofill
72 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H_