| 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_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Records and associates a query_id with web form data. Called | 57 // Records and associates a query_id with web form data. Called |
| 58 // when the renderer posts an Autofill query to the browser. |bounds| | 58 // when the renderer posts an Autofill query to the browser. |bounds| |
| 59 // is window relative. |display_warning_if_disabled| tells us if we should | 59 // is window relative. |display_warning_if_disabled| tells us if we should |
| 60 // display warnings (such as autofill is disabled, but had suggestions). | 60 // display warnings (such as autofill is disabled, but had suggestions). |
| 61 // We might not want to display the warning if a website has disabled | 61 // We might not want to display the warning if a website has disabled |
| 62 // Autocomplete because they have their own popup, and showing our popup | 62 // Autocomplete because they have their own popup, and showing our popup |
| 63 // on to of theirs would be a poor user experience. | 63 // on to of theirs would be a poor user experience. |
| 64 virtual void OnQuery(int query_id, | 64 virtual void OnQuery(int query_id, |
| 65 const FormData& form, | 65 const FormData& form, |
| 66 const FormFieldData& field, | 66 const FormFieldData& field, |
| 67 const gfx::Rect& element_bounds, | 67 const gfx::RectF& element_bounds, |
| 68 bool display_warning_if_disabled); | 68 bool display_warning_if_disabled); |
| 69 | 69 |
| 70 // Records query results and correctly formats them before sending them off | 70 // Records query results and correctly formats them before sending them off |
| 71 // to be displayed. Called when an Autofill query result is available. | 71 // to be displayed. Called when an Autofill query result is available. |
| 72 virtual void OnSuggestionsReturned( | 72 virtual void OnSuggestionsReturned( |
| 73 int query_id, | 73 int query_id, |
| 74 const std::vector<string16>& autofill_values, | 74 const std::vector<string16>& autofill_values, |
| 75 const std::vector<string16>& autofill_labels, | 75 const std::vector<string16>& autofill_labels, |
| 76 const std::vector<string16>& autofill_icons, | 76 const std::vector<string16>& autofill_icons, |
| 77 const std::vector<int>& autofill_unique_ids); | 77 const std::vector<int>& autofill_unique_ids); |
| 78 | 78 |
| 79 // Show password suggestions in the popup. | 79 // Show password suggestions in the popup. |
| 80 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, | 80 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, |
| 81 const FormFieldData& field, | 81 const FormFieldData& field, |
| 82 const gfx::Rect& bounds); | 82 const gfx::RectF& bounds); |
| 83 | 83 |
| 84 // Set the data list value associated with the current field. | 84 // Set the data list value associated with the current field. |
| 85 void SetCurrentDataListValues(const std::vector<string16>& autofill_values, | 85 void SetCurrentDataListValues(const std::vector<string16>& autofill_values, |
| 86 const std::vector<string16>& autofill_labels, | 86 const std::vector<string16>& autofill_labels, |
| 87 const std::vector<string16>& autofill_icons, | 87 const std::vector<string16>& autofill_icons, |
| 88 const std::vector<int>& autofill_unique_ids); | 88 const std::vector<int>& autofill_unique_ids); |
| 89 | 89 |
| 90 // Inform the delegate that the text field editing has ended. This is | 90 // Inform the delegate that the text field editing has ended. This is |
| 91 // used to help record the metrics of when a new popup is shown. | 91 // used to help record the metrics of when a new popup is shown. |
| 92 void DidEndTextFieldEditing(); | 92 void DidEndTextFieldEditing(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 112 // that lives completely in the browser. The suggestions have been correctly | 112 // that lives completely in the browser. The suggestions have been correctly |
| 113 // formatted by this point. | 113 // formatted by this point. |
| 114 virtual void ApplyAutofillSuggestions( | 114 virtual void ApplyAutofillSuggestions( |
| 115 const std::vector<string16>& autofill_values, | 115 const std::vector<string16>& autofill_values, |
| 116 const std::vector<string16>& autofill_labels, | 116 const std::vector<string16>& autofill_labels, |
| 117 const std::vector<string16>& autofill_icons, | 117 const std::vector<string16>& autofill_icons, |
| 118 const std::vector<int>& autofill_unique_ids); | 118 const std::vector<int>& autofill_unique_ids); |
| 119 | 119 |
| 120 // Create the popup if it doesn't already exist. |element_bounds| is the | 120 // Create the popup if it doesn't already exist. |element_bounds| is the |
| 121 // bounding rect for the element it is popping up for. | 121 // bounding rect for the element it is popping up for. |
| 122 virtual void EnsurePopupForElement(const gfx::Rect& element_bounds); | 122 virtual void EnsurePopupForElement(const gfx::RectF& element_bounds); |
| 123 | 123 |
| 124 content::WebContents* web_contents() { return web_contents_; } | 124 content::WebContents* web_contents() { return web_contents_; } |
| 125 | 125 |
| 126 AutofillPopupControllerImpl* controller() { return controller_; } | 126 AutofillPopupControllerImpl* controller() { return controller_; } |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 // Fills the form with the Autofill data corresponding to |unique_id|. | 129 // Fills the form with the Autofill data corresponding to |unique_id|. |
| 130 // If |is_preview| is true then this is just a preview to show the user what | 130 // If |is_preview| is true then this is just a preview to show the user what |
| 131 // would be selected and if |is_preview| is false then the user has selected | 131 // would be selected and if |is_preview| is false then the user has selected |
| 132 // this data. | 132 // this data. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // The current data list values. | 187 // The current data list values. |
| 188 std::vector<string16> data_list_values_; | 188 std::vector<string16> data_list_values_; |
| 189 std::vector<string16> data_list_labels_; | 189 std::vector<string16> data_list_labels_; |
| 190 std::vector<string16> data_list_icons_; | 190 std::vector<string16> data_list_icons_; |
| 191 std::vector<int> data_list_unique_ids_; | 191 std::vector<int> data_list_unique_ids_; |
| 192 | 192 |
| 193 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 193 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 196 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |