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_KEYBOARD_ACCESSORY_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H_ |
6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 15 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
16 | 16 |
17 namespace autofill { | 17 namespace autofill { |
18 | 18 |
19 class AutofillPopupController; | 19 class AutofillPopupController; |
20 | 20 |
21 // A suggestion view that acts as an alternative to the field-attached popup | 21 // A suggestion view that acts as an alternative to the field-attached popup |
22 // window. This view appears above the keyboard and spans the width of the | 22 // window. This view appears above the keyboard and spans the width of the |
23 // screen, condensing rather than overlaying the content area. Enable via | 23 // screen, condensing rather than overlaying the content area. |
24 // --enable-autofill-keyboard-accessory-view. | |
25 class AutofillKeyboardAccessoryView : public AutofillPopupView { | 24 class AutofillKeyboardAccessoryView : public AutofillPopupView { |
26 public: | 25 public: |
27 explicit AutofillKeyboardAccessoryView(AutofillPopupController* controller); | 26 AutofillKeyboardAccessoryView(AutofillPopupController* controller, |
| 27 unsigned int animation_duration_millis, |
| 28 bool should_limit_label_width); |
28 | 29 |
29 // -------------------------------------------------------------------------- | 30 // -------------------------------------------------------------------------- |
30 // Methods called from Java via JNI | 31 // Methods called from Java via JNI |
31 // -------------------------------------------------------------------------- | 32 // -------------------------------------------------------------------------- |
32 // Called when an autofill item was selected. | 33 // Called when an autofill item was selected. |
33 void SuggestionSelected(JNIEnv* env, | 34 void SuggestionSelected(JNIEnv* env, |
34 const base::android::JavaParamRef<jobject>& obj, | 35 const base::android::JavaParamRef<jobject>& obj, |
35 jint list_index); | 36 jint list_index); |
36 | 37 |
37 void DeletionRequested(JNIEnv* env, | 38 void DeletionRequested(JNIEnv* env, |
(...skipping 14 matching lines...) Expand all Loading... |
52 void Hide() override; | 53 void Hide() override; |
53 void OnSelectedRowChanged(base::Optional<int> previous_row_selection, | 54 void OnSelectedRowChanged(base::Optional<int> previous_row_selection, |
54 base::Optional<int> current_row_selection) override; | 55 base::Optional<int> current_row_selection) override; |
55 void OnSuggestionsChanged() override; | 56 void OnSuggestionsChanged() override; |
56 | 57 |
57 private: | 58 private: |
58 ~AutofillKeyboardAccessoryView() override; | 59 ~AutofillKeyboardAccessoryView() override; |
59 | 60 |
60 AutofillPopupController* controller_; // weak. | 61 AutofillPopupController* controller_; // weak. |
61 | 62 |
| 63 // If 0, don't animate suggestion view. |
| 64 const unsigned int animation_duration_millis_; |
| 65 |
| 66 // If true, limits label width to 1/2 device's width. |
| 67 const bool should_limit_label_width_; |
| 68 |
62 // The index of the last item the user long-pressed (they will be shown a | 69 // The index of the last item the user long-pressed (they will be shown a |
63 // confirmation dialog). | 70 // confirmation dialog). |
64 int deleting_index_; | 71 int deleting_index_; |
65 | 72 |
66 // Mapping from Java list index to autofill suggestion index. | 73 // Mapping from Java list index to autofill suggestion index. |
67 std::vector<int> positions_; | 74 std::vector<int> positions_; |
68 | 75 |
69 // The corresponding java object. | 76 // The corresponding java object. |
70 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 77 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
71 | 78 |
72 DISALLOW_COPY_AND_ASSIGN(AutofillKeyboardAccessoryView); | 79 DISALLOW_COPY_AND_ASSIGN(AutofillKeyboardAccessoryView); |
73 }; | 80 }; |
74 | 81 |
75 } // namespace autofill | 82 } // namespace autofill |
76 | 83 |
77 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H
_ | 84 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H
_ |
OLD | NEW |