Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h

Issue 2874933008: Adds animation as feature variation to keyboard accessory. (Closed)
Patch Set: Merge forward Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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,
please use gerrit instead 2017/05/15 14:37:29 Let's keep signedness consistent throughout. This
csashi 2017/05/15 20:07:26 Done.
28 bool should_limit_label_width,
29 bool is_first_suggestion_a_hint);
28 30
29 // -------------------------------------------------------------------------- 31 // --------------------------------------------------------------------------
30 // Methods called from Java via JNI 32 // Methods called from Java via JNI
31 // -------------------------------------------------------------------------- 33 // --------------------------------------------------------------------------
32 // Called when an autofill item was selected. 34 // Called when an autofill item was selected.
33 void SuggestionSelected(JNIEnv* env, 35 void SuggestionSelected(JNIEnv* env,
34 const base::android::JavaParamRef<jobject>& obj, 36 const base::android::JavaParamRef<jobject>& obj,
35 jint list_index); 37 jint list_index);
36 38
37 void DeletionRequested(JNIEnv* env, 39 void DeletionRequested(JNIEnv* env,
(...skipping 14 matching lines...) Expand all
52 void Hide() override; 54 void Hide() override;
53 void OnSelectedRowChanged(base::Optional<int> previous_row_selection, 55 void OnSelectedRowChanged(base::Optional<int> previous_row_selection,
54 base::Optional<int> current_row_selection) override; 56 base::Optional<int> current_row_selection) override;
55 void OnSuggestionsChanged() override; 57 void OnSuggestionsChanged() override;
56 58
57 private: 59 private:
58 ~AutofillKeyboardAccessoryView() override; 60 ~AutofillKeyboardAccessoryView() override;
59 61
60 AutofillPopupController* controller_; // weak. 62 AutofillPopupController* controller_; // weak.
61 63
64 const int animation_duration_millis_; // If 0, don't animate suggestion view.
65
66 // If true, limits label width to 1/2 device's pixel width.
67 const bool should_limit_label_width_;
68
69 // If true and |animation_duration_millis_| > 0, we reverse the animation and
70 // scroll the first suggestion (which is a non-fillable hint) out of the
71 // viewport at the end of the reversed animation.
72 const bool is_first_suggestion_a_hint_;
73
62 // The index of the last item the user long-pressed (they will be shown a 74 // The index of the last item the user long-pressed (they will be shown a
63 // confirmation dialog). 75 // confirmation dialog).
64 int deleting_index_; 76 int deleting_index_;
65 77
66 // Mapping from Java list index to autofill suggestion index. 78 // Mapping from Java list index to autofill suggestion index.
67 std::vector<int> positions_; 79 std::vector<int> positions_;
68 80
69 // The corresponding java object. 81 // The corresponding java object.
70 base::android::ScopedJavaGlobalRef<jobject> java_object_; 82 base::android::ScopedJavaGlobalRef<jobject> java_object_;
71 83
72 DISALLOW_COPY_AND_ASSIGN(AutofillKeyboardAccessoryView); 84 DISALLOW_COPY_AND_ASSIGN(AutofillKeyboardAccessoryView);
73 }; 85 };
74 86
75 } // namespace autofill 87 } // namespace autofill
76 88
77 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H _ 89 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_VIEW_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698