| 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 namespace autofill { | 8 namespace autofill { |
| 9 class PasswordGenerator; | 9 class PasswordGenerator; |
| 10 } | 10 } |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class BrowserContext; | 13 class BrowserContext; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Rect; | 17 class Rect; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace webkit { | 20 namespace webkit { |
| 21 namespace forms { | 21 namespace forms { |
| 22 struct PasswordForm; | 22 struct PasswordForm; |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 | 25 |
| 26 class InfoBarService; | 26 class InfoBarService; |
| 27 class PrefServiceBase; | 27 class PrefServiceBase; |
| 28 class ProfileSyncServiceBase; |
| 28 | 29 |
| 29 namespace autofill { | 30 namespace autofill { |
| 30 | 31 |
| 31 // A delegate interface that needs to be supplied to AutofillManager | 32 // A delegate interface that needs to be supplied to AutofillManager |
| 32 // by the embedder. | 33 // by the embedder. |
| 33 // | 34 // |
| 34 // Each delegate instance is associated with a given context within | 35 // Each delegate instance is associated with a given context within |
| 35 // which an AutofillManager is used (e.g. a single tab), so when we | 36 // which an AutofillManager is used (e.g. a single tab), so when we |
| 36 // say "for the delegate" below, we mean "in the execution context the | 37 // say "for the delegate" below, we mean "in the execution context the |
| 37 // delegate is associated with" (e.g. for the tab the AutofillManager is | 38 // delegate is associated with" (e.g. for the tab the AutofillManager is |
| 38 // attached to). | 39 // attached to). |
| 39 class AutofillManagerDelegate { | 40 class AutofillManagerDelegate { |
| 40 public: | 41 public: |
| 41 virtual ~AutofillManagerDelegate() {} | 42 virtual ~AutofillManagerDelegate() {} |
| 42 | 43 |
| 43 // Gets the BrowserContext the AutofillManager is in. | 44 // Gets the BrowserContext associated with the delegate. |
| 44 virtual content::BrowserContext* GetBrowserContext() const = 0; | 45 virtual content::BrowserContext* GetBrowserContext() const = 0; |
| 45 | 46 |
| 46 // Gets the BrowserContext the AutofillManager is in, or if in an | 47 // Gets the BrowserContext associated with the delegate, or if in an |
| 47 // incognito mode, the associated (original) BrowserContext. | 48 // incognito mode, the associated (original) BrowserContext. |
| 48 virtual content::BrowserContext* GetOriginalBrowserContext() const = 0; | 49 virtual content::BrowserContext* GetOriginalBrowserContext() const = 0; |
| 49 | 50 |
| 50 // Gets the infobar service associated with the delegate. | 51 // Gets the infobar service associated with the delegate. |
| 51 virtual InfoBarService* GetInfoBarService() = 0; | 52 virtual InfoBarService* GetInfoBarService() = 0; |
| 52 | 53 |
| 53 // Gets the preferences associated with the delegate. | 54 // Gets the preferences associated with the delegate. |
| 54 virtual PrefServiceBase* GetPrefs() = 0; | 55 virtual PrefServiceBase* GetPrefs() = 0; |
| 55 | 56 |
| 57 // Gets the profile sync service associated with the delegate. Will |
| 58 // be NULL if sync is not enabled. |
| 59 virtual ProfileSyncServiceBase* GetProfileSyncService() = 0; |
| 60 |
| 56 // Returns true if saving passwords is currently enabled for the | 61 // Returns true if saving passwords is currently enabled for the |
| 57 // delegate. | 62 // delegate. |
| 58 virtual bool IsSavingPasswordsEnabled() const = 0; | 63 virtual bool IsSavingPasswordsEnabled() const = 0; |
| 59 | 64 |
| 60 // Causes the Autofill settings UI to be shown. | 65 // Causes the Autofill settings UI to be shown. |
| 61 virtual void ShowAutofillSettings() = 0; | 66 virtual void ShowAutofillSettings() = 0; |
| 62 | 67 |
| 63 // Causes the password generation bubble UI to be shown using the | 68 // Causes the password generation bubble UI to be shown using the |
| 64 // specified form with the given bounds. | 69 // specified form with the given bounds. |
| 65 virtual void ShowPasswordGenerationBubble( | 70 virtual void ShowPasswordGenerationBubble( |
| 66 const gfx::Rect& bounds, | 71 const gfx::Rect& bounds, |
| 67 const webkit::forms::PasswordForm& form, | 72 const webkit::forms::PasswordForm& form, |
| 68 autofill::PasswordGenerator* generator) = 0; | 73 autofill::PasswordGenerator* generator) = 0; |
| 69 }; | 74 }; |
| 70 | 75 |
| 71 } // namespace autofill | 76 } // namespace autofill |
| 72 | 77 |
| 73 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_ | 78 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_ |
| OLD | NEW |