| 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 CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_GENERATION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_GENERATION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_GENERATION_MANAGER_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_GENERATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/prefs/pref_change_registrar.h" | 11 #include "base/prefs/pref_change_registrar.h" |
| 12 #include "chrome/browser/sync/profile_sync_service_observer.h" | 12 #include "chrome/browser/sync/profile_sync_service_observer.h" |
| 13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 14 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
| 15 | 15 |
| 16 namespace autofill { | 16 namespace autofill { |
| 17 class PasswordGenerator; | 17 class PasswordGenerator; |
| 18 } | |
| 19 | |
| 20 namespace content { | |
| 21 struct PasswordForm; | 18 struct PasswordForm; |
| 22 } | 19 } |
| 23 | 20 |
| 24 namespace user_prefs { | 21 namespace user_prefs { |
| 25 class PrefRegistrySyncable; | 22 class PrefRegistrySyncable; |
| 26 } | 23 } |
| 27 | 24 |
| 28 // Per-tab manager for password generation. Will enable this feature only if | 25 // Per-tab manager for password generation. Will enable this feature only if |
| 29 // | 26 // |
| 30 // - Password manager is enabled | 27 // - Password manager is enabled |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 76 |
| 80 // Sends a message to the renderer enabling or disabling this feature. This | 77 // Sends a message to the renderer enabling or disabling this feature. This |
| 81 // is a separate function to aid in testing. | 78 // is a separate function to aid in testing. |
| 82 virtual void SendStateToRenderer(content::RenderViewHost* host, bool enabled); | 79 virtual void SendStateToRenderer(content::RenderViewHost* host, bool enabled); |
| 83 | 80 |
| 84 // Causes the password generation bubble UI to be shown for the specified | 81 // Causes the password generation bubble UI to be shown for the specified |
| 85 // form. The popup will be anchored at |icon_bounds|. The generated | 82 // form. The popup will be anchored at |icon_bounds|. The generated |
| 86 // password will be no longer than |max_length|. | 83 // password will be no longer than |max_length|. |
| 87 void OnShowPasswordGenerationPopup(const gfx::Rect& icon_bounds, | 84 void OnShowPasswordGenerationPopup(const gfx::Rect& icon_bounds, |
| 88 int max_length, | 85 int max_length, |
| 89 const content::PasswordForm& form); | 86 const autofill::PasswordForm& form); |
| 90 | 87 |
| 91 // Whether password generation is enabled. | 88 // Whether password generation is enabled. |
| 92 bool enabled_; | 89 bool enabled_; |
| 93 | 90 |
| 94 // Listens for changes to the state of the password generation pref. | 91 // Listens for changes to the state of the password generation pref. |
| 95 PrefChangeRegistrar registrar_; | 92 PrefChangeRegistrar registrar_; |
| 96 | 93 |
| 97 // For vending a weak_ptr for |registrar_|. | 94 // For vending a weak_ptr for |registrar_|. |
| 98 base::WeakPtrFactory<PasswordGenerationManager> weak_factory_; | 95 base::WeakPtrFactory<PasswordGenerationManager> weak_factory_; |
| 99 | 96 |
| 100 // Controls how passwords are generated. | 97 // Controls how passwords are generated. |
| 101 scoped_ptr<autofill::PasswordGenerator> password_generator_; | 98 scoped_ptr<autofill::PasswordGenerator> password_generator_; |
| 102 | 99 |
| 103 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager); | 100 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager); |
| 104 }; | 101 }; |
| 105 | 102 |
| 106 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_GENERATION_MANAGER_H_ | 103 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_GENERATION_MANAGER_H_ |
| OLD | NEW |