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" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "chrome/browser/autofill/password_autofill_manager.h" | 12 #include "chrome/browser/autofill/password_autofill_manager.h" |
13 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
14 #include "webkit/forms/form_data.h" | 14 #include "webkit/forms/form_data.h" |
15 #include "webkit/forms/form_field.h" | 15 #include "webkit/forms/form_field.h" |
16 #include "webkit/forms/password_form_dom_manager.h" | 16 #include "webkit/forms/password_form_dom_manager.h" |
17 | 17 |
18 class AutofillManager; | 18 class AutofillManager; |
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 |
24 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 28 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
25 // Once Autofill is moved out of WebKit this class should be the only home for | 29 // Once Autofill is moved out of WebKit this class should be the only home for |
26 // this logic. See http://crbug.com/51644 | 30 // this logic. See http://crbug.com/51644 |
27 | 31 |
28 // Delegate for external processing of Autocomplete and Autofill | 32 // Delegate for external processing of Autocomplete and Autofill |
29 // display and selection. | 33 // display and selection. |
30 class AutofillExternalDelegate { | 34 class AutofillExternalDelegate { |
31 public: | 35 public: |
32 virtual ~AutofillExternalDelegate(); | 36 virtual ~AutofillExternalDelegate(); |
33 | 37 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 130 |
127 // Handle platform-dependent hiding. | 131 // Handle platform-dependent hiding. |
128 virtual void HideAutofillPopupInternal() = 0; | 132 virtual void HideAutofillPopupInternal() = 0; |
129 | 133 |
130 // Set the bounds of the Autofill element being worked with. | 134 // Set the bounds of the Autofill element being worked with. |
131 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 135 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
132 | 136 |
133 // Return the profile that this autofill delegate is currently working with. | 137 // Return the profile that this autofill delegate is currently working with. |
134 Profile* profile() { return tab_contents_->profile(); } | 138 Profile* profile() { return tab_contents_->profile(); } |
135 | 139 |
| 140 // Return the web_contents assoicated with this delegate. |
| 141 content::WebContents* web_contents() { return tab_contents_->web_contents(); } |
| 142 |
136 private: | 143 private: |
137 // Fills the form with the Autofill data corresponding to |unique_id|. | 144 // Fills the form with the Autofill data corresponding to |unique_id|. |
138 // If |is_preview| is true then this is just a preview to show the user what | 145 // If |is_preview| is true then this is just a preview to show the user what |
139 // would be selected and if |is_preview| is false then the user has selected | 146 // would be selected and if |is_preview| is false then the user has selected |
140 // this data. | 147 // this data. |
141 void FillAutofillFormData(int unique_id, bool is_preview); | 148 void FillAutofillFormData(int unique_id, bool is_preview); |
142 | 149 |
143 // Handle applying any Autofill warnings to the Autofill popup. | 150 // Handle applying any Autofill warnings to the Autofill popup. |
144 void ApplyAutofillWarnings(std::vector<string16>* autofill_values, | 151 void ApplyAutofillWarnings(std::vector<string16>* autofill_values, |
145 std::vector<string16>* autofill_labels, | 152 std::vector<string16>* autofill_labels, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // The current data list values. | 195 // The current data list values. |
189 std::vector<string16> data_list_values_; | 196 std::vector<string16> data_list_values_; |
190 std::vector<string16> data_list_labels_; | 197 std::vector<string16> data_list_labels_; |
191 std::vector<string16> data_list_icons_; | 198 std::vector<string16> data_list_icons_; |
192 std::vector<int> data_list_unique_ids_; | 199 std::vector<int> data_list_unique_ids_; |
193 | 200 |
194 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 201 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
195 }; | 202 }; |
196 | 203 |
197 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 204 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |