| 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 #include "chrome/browser/password_manager/password_store_factory.h" | 5 #include "chrome/browser/password_manager/password_store_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 bool ShouldAffiliationBasedMatchingBeActive(Profile* profile) { | 92 bool ShouldAffiliationBasedMatchingBeActive(Profile* profile) { |
| 93 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 93 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 94 if (!password_manager::IsAffiliationBasedMatchingEnabled(*command_line)) | 94 if (!password_manager::IsAffiliationBasedMatchingEnabled(*command_line)) |
| 95 return false; | 95 return false; |
| 96 | 96 |
| 97 DCHECK(profile); | 97 DCHECK(profile); |
| 98 ProfileSyncService* profile_sync_service = | 98 ProfileSyncService* profile_sync_service = |
| 99 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 99 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 100 return profile_sync_service && | 100 return profile_sync_service && |
| 101 profile_sync_service->IsSyncEnabledAndLoggedIn() && | 101 profile_sync_service->IsSyncEnabledAndLoggedIn() && |
| 102 profile_sync_service->SyncActive() && | 102 profile_sync_service->IsSyncActive() && |
| 103 profile_sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && | 103 profile_sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && |
| 104 !profile_sync_service->IsUsingSecondaryPassphrase(); | 104 !profile_sync_service->IsUsingSecondaryPassphrase(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool ShouldPropagatingPasswordChangesToWebCredentialsBeEnabled() { | 107 bool ShouldPropagatingPasswordChangesToWebCredentialsBeEnabled() { |
| 108 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 108 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 109 return password_manager::IsPropagatingPasswordChangesToWebCredentialsEnabled( | 109 return password_manager::IsPropagatingPasswordChangesToWebCredentialsEnabled( |
| 110 *command_line); | 110 *command_line); |
| 111 } | 111 } |
| 112 | 112 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 LocalProfileId id = GetLocalProfileId(prefs); | 305 LocalProfileId id = GetLocalProfileId(prefs); |
| 306 | 306 |
| 307 scoped_ptr<PasswordStoreX::NativeBackend> backend; | 307 scoped_ptr<PasswordStoreX::NativeBackend> backend; |
| 308 if (used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4) { | 308 if (used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4) { |
| 309 // KDE3 didn't use DBus, which our KWallet store uses. | 309 // KDE3 didn't use DBus, which our KWallet store uses. |
| 310 VLOG(1) << "Trying KWallet for password storage."; | 310 VLOG(1) << "Trying KWallet for password storage."; |
| 311 backend.reset(new NativeBackendKWallet(id)); | 311 backend.reset(new NativeBackendKWallet(id)); |
| 312 if (backend->Init()) { | 312 if (backend->Init()) { |
| 313 VLOG(1) << "Using KWallet for password storage."; | 313 VLOG(1) << "Using KWallet for password storage."; |
| 314 used_backend = KWALLET; | 314 used_backend = KWALLET; |
| 315 } else | 315 } else { |
| 316 backend.reset(); | 316 backend.reset(); |
| 317 } |
| 317 } else if (used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_GNOME || | 318 } else if (used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_GNOME || |
| 318 used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_UNITY || | 319 used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_UNITY || |
| 319 used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_XFCE) { | 320 used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_XFCE) { |
| 320 #if defined(USE_LIBSECRET) | 321 #if defined(USE_LIBSECRET) |
| 321 if (base::FieldTrialList::FindFullName(kLibsecretFieldTrialName) != | 322 if (base::FieldTrialList::FindFullName(kLibsecretFieldTrialName) != |
| 322 kLibsecretFieldTrialDisabledGroupName) { | 323 kLibsecretFieldTrialDisabledGroupName) { |
| 323 VLOG(1) << "Trying libsecret for password storage."; | 324 VLOG(1) << "Trying libsecret for password storage."; |
| 324 backend.reset(new NativeBackendLibsecret(id)); | 325 backend.reset(new NativeBackendLibsecret(id)); |
| 325 if (backend->Init()) { | 326 if (backend->Init()) { |
| 326 VLOG(1) << "Using libsecret keyring for password storage."; | 327 VLOG(1) << "Using libsecret keyring for password storage."; |
| 327 used_backend = LIBSECRET; | 328 used_backend = LIBSECRET; |
| 328 } else | 329 } else { |
| 329 backend.reset(); | 330 backend.reset(); |
| 331 } |
| 330 } | 332 } |
| 331 #endif // defined(USE_LIBSECRET) | 333 #endif // defined(USE_LIBSECRET) |
| 332 if (!backend.get()) { | 334 if (!backend.get()) { |
| 333 #if defined(USE_GNOME_KEYRING) | 335 #if defined(USE_GNOME_KEYRING) |
| 334 VLOG(1) << "Trying GNOME keyring for password storage."; | 336 VLOG(1) << "Trying GNOME keyring for password storage."; |
| 335 backend.reset(new NativeBackendGnome(id)); | 337 backend.reset(new NativeBackendGnome(id)); |
| 336 if (backend->Init()) { | 338 if (backend->Init()) { |
| 337 VLOG(1) << "Using GNOME keyring for password storage."; | 339 VLOG(1) << "Using GNOME keyring for password storage."; |
| 338 used_backend = GNOME_KEYRING; | 340 used_backend = GNOME_KEYRING; |
| 339 } else | 341 } else { |
| 340 backend.reset(); | 342 backend.reset(); |
| 343 } |
| 341 #endif // defined(USE_GNOME_KEYRING) | 344 #endif // defined(USE_GNOME_KEYRING) |
| 342 } | 345 } |
| 343 } | 346 } |
| 344 | 347 |
| 345 if (!backend.get()) { | 348 if (!backend.get()) { |
| 346 LOG(WARNING) << "Using basic (unencrypted) store for password storage. " | 349 LOG(WARNING) << "Using basic (unencrypted) store for password storage. " |
| 347 "See http://code.google.com/p/chromium/wiki/LinuxPasswordStorage for " | 350 "See http://code.google.com/p/chromium/wiki/LinuxPasswordStorage for " |
| 348 "more information about password storage options."; | 351 "more information about password storage options."; |
| 349 } | 352 } |
| 350 | 353 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 break; | 448 break; |
| 446 case LIBSECRET: | 449 case LIBSECRET: |
| 447 usage = OTHER_LIBSECRET; | 450 usage = OTHER_LIBSECRET; |
| 448 break; | 451 break; |
| 449 } | 452 } |
| 450 } | 453 } |
| 451 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, | 454 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, |
| 452 MAX_BACKEND_USAGE_VALUE); | 455 MAX_BACKEND_USAGE_VALUE); |
| 453 } | 456 } |
| 454 #endif | 457 #endif |
| OLD | NEW |