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