| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "components/autofill/core/browser/autofill_popup_delegate.h" | 13 #include "components/autofill/core/browser/autofill_popup_delegate.h" |
| 14 #include "components/autofill/core/browser/password_autofill_manager.h" | |
| 15 #include "components/autofill/core/common/form_data.h" | 14 #include "components/autofill/core/common/form_data.h" |
| 16 #include "components/autofill/core/common/form_field_data.h" | 15 #include "components/autofill/core/common/form_field_data.h" |
| 17 #include "components/autofill/core/common/password_form_fill_data.h" | |
| 18 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 19 | 17 |
| 20 namespace gfx { | |
| 21 class Rect; | |
| 22 } | |
| 23 | |
| 24 namespace autofill { | 18 namespace autofill { |
| 25 | 19 |
| 26 class AutofillDriver; | 20 class AutofillDriver; |
| 27 class AutofillManager; | 21 class AutofillManager; |
| 28 | 22 |
| 29 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 23 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
| 30 // Once Autofill is moved out of WebKit this class should be the only home for | 24 // Once Autofill is moved out of WebKit this class should be the only home for |
| 31 // this logic. See http://crbug.com/51644 | 25 // this logic. See http://crbug.com/51644 |
| 32 | 26 |
| 33 // Delegate for in-browser Autocomplete and Autofill display and selection. | 27 // Delegate for in-browser Autocomplete and Autofill display and selection. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 61 |
| 68 // Records query results and correctly formats them before sending them off | 62 // Records query results and correctly formats them before sending them off |
| 69 // to be displayed. Called when an Autofill query result is available. | 63 // to be displayed. Called when an Autofill query result is available. |
| 70 virtual void OnSuggestionsReturned( | 64 virtual void OnSuggestionsReturned( |
| 71 int query_id, | 65 int query_id, |
| 72 const std::vector<base::string16>& values, | 66 const std::vector<base::string16>& values, |
| 73 const std::vector<base::string16>& labels, | 67 const std::vector<base::string16>& labels, |
| 74 const std::vector<base::string16>& icons, | 68 const std::vector<base::string16>& icons, |
| 75 const std::vector<int>& unique_ids); | 69 const std::vector<int>& unique_ids); |
| 76 | 70 |
| 77 // Show password suggestions in the popup. | |
| 78 void OnShowPasswordSuggestions(const std::vector<base::string16>& suggestions, | |
| 79 const std::vector<base::string16>& realms, | |
| 80 const FormFieldData& field, | |
| 81 const gfx::RectF& bounds); | |
| 82 | |
| 83 // Set the data list value associated with the current field. | 71 // Set the data list value associated with the current field. |
| 84 void SetCurrentDataListValues( | 72 void SetCurrentDataListValues( |
| 85 const std::vector<base::string16>& data_list_values, | 73 const std::vector<base::string16>& data_list_values, |
| 86 const std::vector<base::string16>& data_list_labels); | 74 const std::vector<base::string16>& data_list_labels); |
| 87 | 75 |
| 88 // Inform the delegate that the text field editing has ended. This is | 76 // Inform the delegate that the text field editing has ended. This is |
| 89 // used to help record the metrics of when a new popup is shown. | 77 // used to help record the metrics of when a new popup is shown. |
| 90 void DidEndTextFieldEditing(); | 78 void DidEndTextFieldEditing(); |
| 91 | 79 |
| 92 // Returns the delegate to its starting state by removing any page specific | 80 // Returns the delegate to its starting state by removing any page specific |
| 93 // values or settings. | 81 // values or settings. |
| 94 void Reset(); | 82 void Reset(); |
| 95 | 83 |
| 96 // Inform the Password Manager of a filled form. | |
| 97 void AddPasswordFormMapping(const FormFieldData& username_field, | |
| 98 const PasswordFormFillData& fill_data); | |
| 99 | |
| 100 protected: | 84 protected: |
| 101 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr(); | 85 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr(); |
| 102 | 86 |
| 103 private: | 87 private: |
| 104 // Fills the form with the Autofill data corresponding to |unique_id|. | 88 // Fills the form with the Autofill data corresponding to |unique_id|. |
| 105 // If |is_preview| is true then this is just a preview to show the user what | 89 // If |is_preview| is true then this is just a preview to show the user what |
| 106 // would be selected and if |is_preview| is false then the user has selected | 90 // would be selected and if |is_preview| is false then the user has selected |
| 107 // this data. | 91 // this data. |
| 108 void FillAutofillFormData(int unique_id, bool is_preview); | 92 void FillAutofillFormData(int unique_id, bool is_preview); |
| 109 | 93 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 127 std::vector<base::string16>* labels, | 111 std::vector<base::string16>* labels, |
| 128 std::vector<base::string16>* icons, | 112 std::vector<base::string16>* icons, |
| 129 std::vector<int>* unique_ids); | 113 std::vector<int>* unique_ids); |
| 130 | 114 |
| 131 AutofillManager* manager_; // weak. | 115 AutofillManager* manager_; // weak. |
| 132 | 116 |
| 133 // Provides driver-level context to the shared code of the component. Must | 117 // Provides driver-level context to the shared code of the component. Must |
| 134 // outlive this object. | 118 // outlive this object. |
| 135 AutofillDriver* driver_; // weak | 119 AutofillDriver* driver_; // weak |
| 136 | 120 |
| 137 // Password Autofill manager, handles all password-related Autofilling. | |
| 138 PasswordAutofillManager password_manager_; | |
| 139 | |
| 140 // The ID of the last request sent for form field Autofill. Used to ignore | 121 // The ID of the last request sent for form field Autofill. Used to ignore |
| 141 // out of date responses. | 122 // out of date responses. |
| 142 int query_id_; | 123 int query_id_; |
| 143 | 124 |
| 144 // The current form and field selected by Autofill. | 125 // The current form and field selected by Autofill. |
| 145 FormData query_form_; | 126 FormData query_form_; |
| 146 FormFieldData query_field_; | 127 FormFieldData query_field_; |
| 147 | 128 |
| 148 // The bounds of the form field that user is interacting with. | 129 // The bounds of the form field that user is interacting with. |
| 149 gfx::RectF element_bounds_; | 130 gfx::RectF element_bounds_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 163 std::vector<base::string16> data_list_labels_; | 144 std::vector<base::string16> data_list_labels_; |
| 164 | 145 |
| 165 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; | 146 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; |
| 166 | 147 |
| 167 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 148 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 168 }; | 149 }; |
| 169 | 150 |
| 170 } // namespace autofill | 151 } // namespace autofill |
| 171 | 152 |
| 172 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 153 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |