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" | 14 #include "components/autofill/core/browser/password_autofill_manager.h" |
15 #include "components/autofill/core/common/form_data.h" | 15 #include "components/autofill/core/common/form_data.h" |
16 #include "components/autofill/core/common/form_field_data.h" | 16 #include "components/autofill/core/common/form_field_data.h" |
17 #include "components/autofill/core/common/password_form_fill_data.h" | 17 #include "components/autofill/core/common/password_form_fill_data.h" |
18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 class Rect; | 21 class Rect; |
22 } | 22 } |
23 | 23 |
24 namespace content { | |
25 class WebContents; | |
26 } | |
27 | |
28 namespace autofill { | 24 namespace autofill { |
29 | 25 |
30 class AutofillDriver; | 26 class AutofillDriver; |
31 class AutofillManager; | 27 class AutofillManager; |
32 | 28 |
33 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 29 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
34 // Once Autofill is moved out of WebKit this class should be the only home for | 30 // Once Autofill is moved out of WebKit this class should be the only home for |
35 // this logic. See http://crbug.com/51644 | 31 // this logic. See http://crbug.com/51644 |
36 | 32 |
37 // Delegate for in-browser Autocomplete and Autofill display and selection. | 33 // Delegate for in-browser Autocomplete and Autofill display and selection. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 // Returns the delegate to its starting state by removing any page specific | 92 // Returns the delegate to its starting state by removing any page specific |
97 // values or settings. | 93 // values or settings. |
98 void Reset(); | 94 void Reset(); |
99 | 95 |
100 // Inform the Password Manager of a filled form. | 96 // Inform the Password Manager of a filled form. |
101 void AddPasswordFormMapping( | 97 void AddPasswordFormMapping( |
102 const FormFieldData& form, | 98 const FormFieldData& form, |
103 const PasswordFormFillData& fill_data); | 99 const PasswordFormFillData& fill_data); |
104 | 100 |
105 protected: | 101 protected: |
106 content::WebContents* web_contents() { return web_contents_; } | |
107 | |
108 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr(); | 102 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr(); |
109 | 103 |
110 private: | 104 private: |
111 // Fills the form with the Autofill data corresponding to |unique_id|. | 105 // Fills the form with the Autofill data corresponding to |unique_id|. |
112 // If |is_preview| is true then this is just a preview to show the user what | 106 // If |is_preview| is true then this is just a preview to show the user what |
113 // would be selected and if |is_preview| is false then the user has selected | 107 // would be selected and if |is_preview| is false then the user has selected |
114 // this data. | 108 // this data. |
115 void FillAutofillFormData(int unique_id, bool is_preview); | 109 void FillAutofillFormData(int unique_id, bool is_preview); |
116 | 110 |
117 // Handle applying any Autofill warnings to the Autofill popup. | 111 // Handle applying any Autofill warnings to the Autofill popup. |
(...skipping 10 matching lines...) Expand all Loading... | |
128 std::vector<base::string16>* autofill_icons, | 122 std::vector<base::string16>* autofill_icons, |
129 std::vector<int>* autofill_unique_ids); | 123 std::vector<int>* autofill_unique_ids); |
130 | 124 |
131 // Insert the data list values at the start of the given list, including | 125 // Insert the data list values at the start of the given list, including |
132 // any required separators. | 126 // any required separators. |
133 void InsertDataListValues(std::vector<base::string16>* autofill_values, | 127 void InsertDataListValues(std::vector<base::string16>* autofill_values, |
134 std::vector<base::string16>* autofill_labels, | 128 std::vector<base::string16>* autofill_labels, |
135 std::vector<base::string16>* autofill_icons, | 129 std::vector<base::string16>* autofill_icons, |
136 std::vector<int>* autofill_unique_ids); | 130 std::vector<int>* autofill_unique_ids); |
137 | 131 |
138 // The web_contents associated with this delegate. | |
139 content::WebContents* web_contents_; // weak; owns me. | |
140 AutofillManager* autofill_manager_; // weak. | 132 AutofillManager* autofill_manager_; // weak. |
141 | 133 |
142 // Provides driver-level context to the shared code of the component. Must | 134 // Provides driver-level context to the shared code of the component. Must |
blundell
2013/11/13 15:26:49
This actually should stay, sorry. It *is* an assum
jif-google
2013/11/13 16:43:03
Ok. I removed it because I felt like it was redund
| |
143 // outlive this object. | 135 // outlive this object. |
144 AutofillDriver* autofill_driver_; // weak | 136 AutofillDriver* autofill_driver_; // weak |
blundell
2013/11/13 11:55:45
It's the AutofillDriver that owns the AutofillExte
jif-google
2013/11/13 14:20:25
I've removed the "Must outlive this object." part.
| |
145 | 137 |
146 // Password Autofill manager, handles all password-related Autofilling. | 138 // Password Autofill manager, handles all password-related Autofilling. |
147 PasswordAutofillManager password_autofill_manager_; | 139 PasswordAutofillManager password_autofill_manager_; |
148 | 140 |
149 // The ID of the last request sent for form field Autofill. Used to ignore | 141 // The ID of the last request sent for form field Autofill. Used to ignore |
150 // out of date responses. | 142 // out of date responses. |
151 int autofill_query_id_; | 143 int autofill_query_id_; |
152 | 144 |
153 // The current form and field selected by Autofill. | 145 // The current form and field selected by Autofill. |
154 FormData autofill_query_form_; | 146 FormData autofill_query_form_; |
(...skipping 17 matching lines...) Expand all Loading... | |
172 std::vector<base::string16> data_list_labels_; | 164 std::vector<base::string16> data_list_labels_; |
173 | 165 |
174 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; | 166 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; |
175 | 167 |
176 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 168 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
177 }; | 169 }; |
178 | 170 |
179 } // namespace autofill | 171 } // namespace autofill |
180 | 172 |
181 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 173 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |