| 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 29 matching lines...) Expand all Loading... |
| 40 content::WebContents* contents) { | 40 content::WebContents* contents) { |
| 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::RegisterProfilePrefs( |
| 51 user_prefs::PrefRegistrySyncable* registry) { | 51 user_prefs::PrefRegistrySyncable* registry) { |
| 52 registry->RegisterBooleanPref( | 52 registry->RegisterBooleanPref( |
| 53 prefs::kPasswordGenerationEnabled, | 53 prefs::kPasswordGenerationEnabled, |
| 54 true, | 54 true, |
| 55 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 55 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void PasswordGenerationManager::RegisterWithSyncService() { | 58 void PasswordGenerationManager::RegisterWithSyncService() { |
| 59 Profile* profile = Profile::FromBrowserContext( | 59 Profile* profile = Profile::FromBrowserContext( |
| 60 web_contents()->GetBrowserContext()); | 60 web_contents()->GetBrowserContext()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 #if defined(OS_ANDROID) | 158 #if defined(OS_ANDROID) |
| 159 NOTIMPLEMENTED(); | 159 NOTIMPLEMENTED(); |
| 160 #else | 160 #else |
| 161 password_generator_.reset(new autofill::PasswordGenerator(max_length)); | 161 password_generator_.reset(new autofill::PasswordGenerator(max_length)); |
| 162 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 162 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 163 browser->window()->ShowPasswordGenerationBubble(bounds, | 163 browser->window()->ShowPasswordGenerationBubble(bounds, |
| 164 form, | 164 form, |
| 165 password_generator_.get()); | 165 password_generator_.get()); |
| 166 #endif // #if defined(OS_ANDROID) | 166 #endif // #if defined(OS_ANDROID) |
| 167 } | 167 } |
| OLD | NEW |