Chromium Code Reviews| 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_MANAGER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_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/memory/scoped_ptr.h" | |
| 11 #include "base/string16.h" | 12 #include "base/string16.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 | 14 |
| 14 namespace autofill { | 15 namespace autofill { |
| 15 class PasswordGenerator; | 16 class PasswordGenerator; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 struct PasswordForm; | 20 struct PasswordForm; |
| 20 struct SSLStatus; | 21 struct SSLStatus; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 31 class GURL; | 32 class GURL; |
| 32 class InfoBarService; | 33 class InfoBarService; |
| 33 class PersonalDataManager; | 34 class PersonalDataManager; |
| 34 class PrefService; | 35 class PrefService; |
| 35 class ProfileSyncServiceBase; | 36 class ProfileSyncServiceBase; |
| 36 | 37 |
| 37 struct FormData; | 38 struct FormData; |
| 38 | 39 |
| 39 namespace autofill { | 40 namespace autofill { |
| 40 | 41 |
| 42 class AutofillCCImportConfirmationDelegate; | |
| 43 | |
| 41 enum DialogType { | 44 enum DialogType { |
| 42 // Autofill dialog for the Autocheckout feature. | 45 // Autofill dialog for the Autocheckout feature. |
| 43 DIALOG_TYPE_AUTOCHECKOUT, | 46 DIALOG_TYPE_AUTOCHECKOUT, |
| 44 // Autofill dialog for the requestAutocomplete feature. | 47 // Autofill dialog for the requestAutocomplete feature. |
| 45 DIALOG_TYPE_REQUEST_AUTOCOMPLETE, | 48 DIALOG_TYPE_REQUEST_AUTOCOMPLETE, |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 // A delegate interface that needs to be supplied to AutofillManager | 51 // A delegate interface that needs to be supplied to AutofillManager |
| 49 // by the embedder. | 52 // by the embedder. |
| 50 // | 53 // |
| 51 // Each delegate instance is associated with a given context within | 54 // Each delegate instance is associated with a given context within |
| 52 // which an AutofillManager is used (e.g. a single tab), so when we | 55 // which an AutofillManager is used (e.g. a single tab), so when we |
| 53 // say "for the delegate" below, we mean "in the execution context the | 56 // say "for the delegate" below, we mean "in the execution context the |
| 54 // delegate is associated with" (e.g. for the tab the AutofillManager is | 57 // delegate is associated with" (e.g. for the tab the AutofillManager is |
| 55 // attached to). | 58 // attached to). |
| 56 class AutofillManagerDelegate { | 59 class AutofillManagerDelegate { |
| 57 public: | 60 public: |
| 58 virtual ~AutofillManagerDelegate() {} | 61 virtual ~AutofillManagerDelegate() {} |
| 59 | 62 |
| 60 // Gets the infobar service associated with the delegate. | |
| 61 virtual InfoBarService* GetInfoBarService() = 0; | |
| 62 | |
| 63 // Gets the PersonalDataManager instance associated with the delegate. | 63 // Gets the PersonalDataManager instance associated with the delegate. |
| 64 virtual PersonalDataManager* GetPersonalDataManager() = 0; | 64 virtual PersonalDataManager* GetPersonalDataManager() = 0; |
| 65 | 65 |
| 66 // Gets the preferences associated with the delegate. | 66 // Gets the preferences associated with the delegate. |
| 67 virtual PrefService* GetPrefs() = 0; | 67 virtual PrefService* GetPrefs() = 0; |
| 68 | 68 |
| 69 // Gets the profile sync service associated with the delegate. Will | 69 // Gets the profile sync service associated with the delegate. Will |
| 70 // be NULL if sync is not enabled. | 70 // be NULL if sync is not enabled. |
| 71 virtual ProfileSyncServiceBase* GetProfileSyncService() = 0; | 71 virtual ProfileSyncServiceBase* GetProfileSyncService() = 0; |
| 72 | 72 |
| 73 // Hides the associated request autocomplete dialog (if it exists). | 73 // Hides the associated request autocomplete dialog (if it exists). |
| 74 virtual void HideRequestAutocompleteDialog() = 0; | 74 virtual void HideRequestAutocompleteDialog() = 0; |
| 75 | 75 |
| 76 // Returns true if saving passwords is currently enabled for the | 76 // Returns true if saving passwords is currently enabled for the |
| 77 // delegate. | 77 // delegate. |
| 78 virtual bool IsSavingPasswordsEnabled() const = 0; | 78 virtual bool IsSavingPasswordsEnabled() const = 0; |
| 79 | 79 |
| 80 // Causes an error explaining that Autocheckout has failed to be displayed to | 80 // Causes an error explaining that Autocheckout has failed to be displayed to |
| 81 // the user. | 81 // the user. |
| 82 virtual void OnAutocheckoutError() = 0; | 82 virtual void OnAutocheckoutError() = 0; |
| 83 | 83 |
| 84 // Causes the Autofill settings UI to be shown. | 84 // Causes the Autofill settings UI to be shown. |
| 85 virtual void ShowAutofillSettings() = 0; | 85 virtual void ShowAutofillSettings() = 0; |
| 86 | 86 |
| 87 // Shows the confirmation UI asking user whether the credit card information | |
| 88 // should be imported (in the form of a confirmation dialog, a chrome | |
| 89 // inforbar, etc...). | |
|
Ilya Sherman
2013/03/04 21:07:34
nit: "inforbar" -> "infobar"
kaiwang
2013/03/05 01:48:56
Done.
| |
| 90 virtual void ShowAutofillCCImportConfirmation( | |
| 91 scoped_ptr<AutofillCCImportConfirmationDelegate> delegate) = 0; | |
|
Jói
2013/03/02 16:21:04
Perhaps add something like this to the documentati
kaiwang
2013/03/05 01:48:56
Done.
| |
| 92 | |
| 87 // Causes the password generation bubble UI to be shown using the | 93 // Causes the password generation bubble UI to be shown using the |
| 88 // specified form with the given bounds. | 94 // specified form with the given bounds. |
| 89 virtual void ShowPasswordGenerationBubble( | 95 virtual void ShowPasswordGenerationBubble( |
| 90 const gfx::Rect& bounds, | 96 const gfx::Rect& bounds, |
| 91 const content::PasswordForm& form, | 97 const content::PasswordForm& form, |
| 92 autofill::PasswordGenerator* generator) = 0; | 98 autofill::PasswordGenerator* generator) = 0; |
| 93 | 99 |
| 94 // Causes the Autocheckout bubble UI to be displayed. |bounding_box| is the | 100 // Causes the Autocheckout bubble UI to be displayed. |bounding_box| is the |
| 95 // anchor for the bubble. |native_view| is the parent view of the bubble. | 101 // anchor for the bubble. |native_view| is the parent view of the bubble. |
| 96 // |callback| is run if the bubble is accepted. | 102 // |callback| is run if the bubble is accepted. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 125 // Hide the Autofill popup if one is currently showing. | 131 // Hide the Autofill popup if one is currently showing. |
| 126 virtual void HideAutofillPopup() = 0; | 132 virtual void HideAutofillPopup() = 0; |
| 127 | 133 |
| 128 // Updates the Autocheckout progress bar. |value| must be in [0.0, 1.0]. | 134 // Updates the Autocheckout progress bar. |value| must be in [0.0, 1.0]. |
| 129 virtual void UpdateProgressBar(double value) = 0; | 135 virtual void UpdateProgressBar(double value) = 0; |
| 130 }; | 136 }; |
| 131 | 137 |
| 132 } // namespace autofill | 138 } // namespace autofill |
| 133 | 139 |
| 134 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_ | 140 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_ |
| OLD | NEW |