OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 void OnPopupHidden() override; | 40 void OnPopupHidden() override; |
41 void DidSelectSuggestion(const base::string16& value, | 41 void DidSelectSuggestion(const base::string16& value, |
42 int identifier) override; | 42 int identifier) override; |
43 void DidAcceptSuggestion(const base::string16& value, | 43 void DidAcceptSuggestion(const base::string16& value, |
44 int identifier) override; | 44 int identifier) override; |
45 void RemoveSuggestion(const base::string16& value, int identifier) override; | 45 void RemoveSuggestion(const base::string16& value, int identifier) override; |
46 void ClearPreviewedForm() override; | 46 void ClearPreviewedForm() override; |
47 | 47 |
48 // Records and associates a query_id with web form data. Called | 48 // Records and associates a query_id with web form data. Called |
49 // when the renderer posts an Autofill query to the browser. |bounds| | 49 // when the renderer posts an Autofill query to the browser. |bounds| |
50 // is window relative. |display_warning_if_disabled| tells us if we should | 50 // is window relative. We might not want to display the warning if a website |
51 // display warnings (such as autofill is disabled, but had suggestions). | 51 // has disabled Autocomplete because they have their own popup, and showing |
52 // We might not want to display the warning if a website has disabled | 52 // our popup on to of theirs would be a poor user experience. |
53 // Autocomplete because they have their own popup, and showing our popup | |
54 // on to of theirs would be a poor user experience. | |
55 virtual void OnQuery(int query_id, | 53 virtual void OnQuery(int query_id, |
56 const FormData& form, | 54 const FormData& form, |
57 const FormFieldData& field, | 55 const FormFieldData& field, |
58 const gfx::RectF& element_bounds, | 56 const gfx::RectF& element_bounds); |
59 bool display_warning_if_disabled); | |
60 | 57 |
61 // Records query results and correctly formats them before sending them off | 58 // Records query results and correctly formats them before sending them off |
62 // to be displayed. Called when an Autofill query result is available. | 59 // to be displayed. Called when an Autofill query result is available. |
63 virtual void OnSuggestionsReturned( | 60 virtual void OnSuggestionsReturned( |
64 int query_id, | 61 int query_id, |
65 const std::vector<Suggestion>& suggestions); | 62 const std::vector<Suggestion>& suggestions); |
66 | 63 |
67 // Set the data list value associated with the current field. | 64 // Set the data list value associated with the current field. |
68 void SetCurrentDataListValues( | 65 void SetCurrentDataListValues( |
69 const std::vector<base::string16>& data_list_values, | 66 const std::vector<base::string16>& data_list_values, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // out of date responses. | 122 // out of date responses. |
126 int query_id_; | 123 int query_id_; |
127 | 124 |
128 // The current form and field selected by Autofill. | 125 // The current form and field selected by Autofill. |
129 FormData query_form_; | 126 FormData query_form_; |
130 FormFieldData query_field_; | 127 FormFieldData query_field_; |
131 | 128 |
132 // The bounds of the form field that user is interacting with. | 129 // The bounds of the form field that user is interacting with. |
133 gfx::RectF element_bounds_; | 130 gfx::RectF element_bounds_; |
134 | 131 |
135 // Should we display a warning if Autofill is disabled? | |
136 bool display_warning_if_disabled_; | |
137 | |
138 // Does the popup include any Autofill profile or credit card suggestions? | 132 // Does the popup include any Autofill profile or credit card suggestions? |
139 bool has_suggestion_; | 133 bool has_suggestion_; |
140 | 134 |
141 // Have we already shown Autofill suggestions for the field the user is | 135 // Have we already shown Autofill suggestions for the field the user is |
142 // currently editing? Used to keep track of state for metrics logging. | 136 // currently editing? Used to keep track of state for metrics logging. |
143 bool has_shown_popup_for_current_edit_; | 137 bool has_shown_popup_for_current_edit_; |
144 | 138 |
145 // FIXME | 139 // FIXME |
146 bool should_show_scan_credit_card_; | 140 bool should_show_scan_credit_card_; |
147 | 141 |
148 // Whether the access Address Book prompt has ever been shown for the current | 142 // Whether the access Address Book prompt has ever been shown for the current |
149 // |query_form_|. This variable is only used on OSX. | 143 // |query_form_|. This variable is only used on OSX. |
150 bool has_shown_address_book_prompt; | 144 bool has_shown_address_book_prompt; |
151 | 145 |
152 // The current data list values. | 146 // The current data list values. |
153 std::vector<base::string16> data_list_values_; | 147 std::vector<base::string16> data_list_values_; |
154 std::vector<base::string16> data_list_labels_; | 148 std::vector<base::string16> data_list_labels_; |
155 | 149 |
156 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; | 150 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; |
157 | 151 |
158 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 152 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
159 }; | 153 }; |
160 | 154 |
161 } // namespace autofill | 155 } // namespace autofill |
162 | 156 |
163 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 157 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |