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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "chrome/browser/autofill/password_autofill_manager.h" | 13 #include "chrome/browser/autofill/password_autofill_manager.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
14 #include "webkit/forms/form_data.h" | 15 #include "webkit/forms/form_data.h" |
15 #include "webkit/forms/form_field.h" | 16 #include "webkit/forms/form_field.h" |
16 #include "webkit/forms/password_form_dom_manager.h" | 17 #include "webkit/forms/password_form_dom_manager.h" |
17 | 18 |
18 class AutofillManager; | 19 class AutofillManager; |
19 class TabContentsWrapper; | |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 class Rect; | 22 class Rect; |
23 } | 23 } |
24 | 24 |
25 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 25 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
26 // Once Autofill is moved out of WebKit this class should be the only home for | 26 // Once Autofill is moved out of WebKit this class should be the only home for |
27 // this logic. See http://crbug.com/51644 | 27 // this logic. See http://crbug.com/51644 |
28 | 28 |
29 // Delegate for external processing of Autocomplete and Autofill | 29 // Delegate for external processing of Autocomplete and Autofill |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 const webkit::forms::FormData& form, | 118 const webkit::forms::FormData& form, |
119 const webkit::forms::FormField& field, | 119 const webkit::forms::FormField& field, |
120 const gfx::Rect& bounds) = 0; | 120 const gfx::Rect& bounds) = 0; |
121 | 121 |
122 // Handle platform-dependent hiding. | 122 // Handle platform-dependent hiding. |
123 virtual void HideAutofillPopupInternal() = 0; | 123 virtual void HideAutofillPopupInternal() = 0; |
124 | 124 |
125 // Set the bounds of the Autofill element being worked with. | 125 // Set the bounds of the Autofill element being worked with. |
126 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 126 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
127 | 127 |
| 128 // Return the profile that this autofill delegate is currently working with. |
| 129 Profile* profile() { return tab_contents_wrapper_->profile(); } |
| 130 |
128 private: | 131 private: |
129 // Fills the form with the Autofill data corresponding to |unique_id|. | 132 // 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 | 133 // 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 | 134 // would be selected and if |is_preview| is false then the user has selected |
132 // this data. | 135 // this data. |
133 void FillAutofillFormData(int unique_id, bool is_preview); | 136 void FillAutofillFormData(int unique_id, bool is_preview); |
134 | 137 |
135 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. | 138 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. |
136 AutofillManager* autofill_manager_; // weak. | 139 AutofillManager* autofill_manager_; // weak. |
137 | 140 |
(...skipping 12 matching lines...) Expand all Loading... |
150 bool display_warning_if_disabled_; | 153 bool display_warning_if_disabled_; |
151 | 154 |
152 // Have we already shown Autofill suggestions for the field the user is | 155 // Have we already shown Autofill suggestions for the field the user is |
153 // currently editing? Used to keep track of state for metrics logging. | 156 // currently editing? Used to keep track of state for metrics logging. |
154 bool has_shown_autofill_popup_for_current_edit_; | 157 bool has_shown_autofill_popup_for_current_edit_; |
155 | 158 |
156 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 159 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
157 }; | 160 }; |
158 | 161 |
159 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 162 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |