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 #include "chrome/browser/password_manager/password_generation_manager.h" | 5 #include "chrome/browser/password_manager/password_generation_manager.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/password_manager/password_manager.h" | 8 #include "chrome/browser/password_manager/password_manager.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/profile_sync_service.h" | 10 #include "chrome/browser/sync/profile_sync_service.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 content::WebContentsUserData<PasswordGenerationManager>:: | 41 content::WebContentsUserData<PasswordGenerationManager>:: |
42 CreateForWebContents(contents); | 42 CreateForWebContents(contents); |
43 | 43 |
44 // Start observing changes to relevant prefs. This is not called in the | 44 // Start observing changes to relevant prefs. This is not called in the |
45 // constructor so that it's not enabled in testing. | 45 // constructor so that it's not enabled in testing. |
46 FromWebContents(contents)->SetUpPrefChangeRegistrar(); | 46 FromWebContents(contents)->SetUpPrefChangeRegistrar(); |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 void PasswordGenerationManager::RegisterUserPrefs( | 50 void PasswordGenerationManager::RegisterUserPrefs( |
51 PrefRegistrySyncable* registry) { | 51 user_prefs::PrefRegistrySyncable* registry) { |
52 registry->RegisterBooleanPref(prefs::kPasswordGenerationEnabled, | 52 registry->RegisterBooleanPref( |
53 true, | 53 prefs::kPasswordGenerationEnabled, |
54 PrefRegistrySyncable::SYNCABLE_PREF); | 54 true, |
| 55 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
55 } | 56 } |
56 | 57 |
57 void PasswordGenerationManager::RegisterWithSyncService() { | 58 void PasswordGenerationManager::RegisterWithSyncService() { |
58 Profile* profile = Profile::FromBrowserContext( | 59 Profile* profile = Profile::FromBrowserContext( |
59 web_contents()->GetBrowserContext()); | 60 web_contents()->GetBrowserContext()); |
60 ProfileSyncService* sync_service = | 61 ProfileSyncService* sync_service = |
61 ProfileSyncServiceFactory::GetForProfile(profile); | 62 ProfileSyncServiceFactory::GetForProfile(profile); |
62 if (sync_service) | 63 if (sync_service) |
63 sync_service->AddObserver(this); | 64 sync_service->AddObserver(this); |
64 } | 65 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 #if defined(OS_ANDROID) | 158 #if defined(OS_ANDROID) |
158 NOTIMPLEMENTED(); | 159 NOTIMPLEMENTED(); |
159 #else | 160 #else |
160 password_generator_.reset(new autofill::PasswordGenerator(max_length)); | 161 password_generator_.reset(new autofill::PasswordGenerator(max_length)); |
161 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 162 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
162 browser->window()->ShowPasswordGenerationBubble(bounds, | 163 browser->window()->ShowPasswordGenerationBubble(bounds, |
163 form, | 164 form, |
164 password_generator_.get()); | 165 password_generator_.get()); |
165 #endif // #if defined(OS_ANDROID) | 166 #endif // #if defined(OS_ANDROID) |
166 } | 167 } |
OLD | NEW |