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_
11 #include "base/android/scoped_java_ref.h"
12 #include "base/compiler_specific.h"
13 #include "chrome/browser/ui/autofill/autofill_popup_view.h"
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
{
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
);
46 // AutofillPopupView implementation.
49 void InvalidateRow(size_t row
) override
;
50 void UpdateBoundsAndRedrawPopup() override
;
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).
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_