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_MANAGER_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLIENT_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLIENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Rect; | 16 class Rect; |
17 class RectF; | 17 class RectF; |
18 } | 18 } |
19 | 19 |
20 class GURL; | 20 class GURL; |
21 class InfoBarService; | 21 class InfoBarService; |
22 class PrefService; | 22 class PrefService; |
23 | 23 |
24 namespace autofill { | 24 namespace autofill { |
25 | 25 |
26 class AutofillMetrics; | 26 class AutofillMetrics; |
27 class AutofillPopupDelegate; | 27 class AutofillPopupDelegate; |
28 class AutofillWebDataService; | 28 class AutofillWebDataService; |
29 class CreditCard; | 29 class CreditCard; |
30 class FormStructure; | 30 class FormStructure; |
31 class PasswordGenerator; | 31 class PasswordGenerator; |
32 class PersonalDataManager; | 32 class PersonalDataManager; |
33 struct FormData; | 33 struct FormData; |
34 struct PasswordForm; | 34 struct PasswordForm; |
35 | 35 |
36 // A delegate interface that needs to be supplied to AutofillManager | 36 // A delegate interface that needs to be supplied to AutofillManager |
blundell
2014/06/03 08:27:11
s/delegate/client throughout this comment
Ilya Sherman
2014/06/03 20:25:43
Done.
| |
37 // by the embedder. | 37 // by the embedder. |
38 // | 38 // |
39 // Each delegate instance is associated with a given context within | 39 // Each delegate instance is associated with a given context within |
40 // which an AutofillManager is used (e.g. a single tab), so when we | 40 // which an AutofillManager is used (e.g. a single tab), so when we |
41 // say "for the delegate" below, we mean "in the execution context the | 41 // say "for the delegate" below, we mean "in the execution context the |
42 // delegate is associated with" (e.g. for the tab the AutofillManager is | 42 // delegate is associated with" (e.g. for the tab the AutofillManager is |
43 // attached to). | 43 // attached to). |
44 class AutofillManagerDelegate { | 44 class AutofillClient { |
45 public: | 45 public: |
46 // Copy of blink::WebFormElement::AutocompleteResult. | 46 // Copy of blink::WebFormElement::AutocompleteResult. |
47 enum RequestAutocompleteResult { | 47 enum RequestAutocompleteResult { |
48 AutocompleteResultSuccess, | 48 AutocompleteResultSuccess, |
49 AutocompleteResultErrorDisabled, | 49 AutocompleteResultErrorDisabled, |
50 AutocompleteResultErrorCancel, | 50 AutocompleteResultErrorCancel, |
51 AutocompleteResultErrorInvalid, | 51 AutocompleteResultErrorInvalid, |
52 }; | 52 }; |
53 | 53 |
54 typedef base::Callback< | 54 typedef base::Callback<void(RequestAutocompleteResult, |
55 void(RequestAutocompleteResult, | 55 const base::string16&, |
56 const base::string16&, | 56 const FormStructure*)> ResultCallback; |
57 const FormStructure*)> ResultCallback; | |
58 | 57 |
59 virtual ~AutofillManagerDelegate() {} | 58 virtual ~AutofillClient() {} |
60 | 59 |
61 // Gets the PersonalDataManager instance associated with the delegate. | 60 // Gets the PersonalDataManager instance associated with the delegate. |
62 virtual PersonalDataManager* GetPersonalDataManager() = 0; | 61 virtual PersonalDataManager* GetPersonalDataManager() = 0; |
63 | 62 |
64 // Gets the AutofillWebDataService instance associated with the delegate. | 63 // Gets the AutofillWebDataService instance associated with the delegate. |
65 virtual scoped_refptr<AutofillWebDataService> GetDatabase() = 0; | 64 virtual scoped_refptr<AutofillWebDataService> GetDatabase() = 0; |
66 | 65 |
67 // Gets the preferences associated with the delegate. | 66 // Gets the preferences associated with the delegate. |
68 virtual PrefService* GetPrefs() = 0; | 67 virtual PrefService* GetPrefs() = 0; |
69 | 68 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 | 109 |
111 // Pass the form structures to the password generation manager to detect | 110 // Pass the form structures to the password generation manager to detect |
112 // account creation forms. | 111 // account creation forms. |
113 virtual void DetectAccountCreationForms( | 112 virtual void DetectAccountCreationForms( |
114 const std::vector<autofill::FormStructure*>& forms) = 0; | 113 const std::vector<autofill::FormStructure*>& forms) = 0; |
115 | 114 |
116 // Inform the delegate that the field has been filled. | 115 // Inform the delegate that the field has been filled. |
117 virtual void DidFillOrPreviewField( | 116 virtual void DidFillOrPreviewField( |
118 const base::string16& autofilled_value, | 117 const base::string16& autofilled_value, |
119 const base::string16& profile_full_name) = 0; | 118 const base::string16& profile_full_name) = 0; |
120 | |
121 }; | 119 }; |
122 | 120 |
123 } // namespace autofill | 121 } // namespace autofill |
124 | 122 |
125 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ | 123 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLIENT_H_ |
OLD | NEW |