| Index: chrome/browser/password_manager/sync_metrics.cc
|
| diff --git a/chrome/browser/password_manager/sync_metrics.cc b/chrome/browser/password_manager/sync_metrics.cc
|
| index 4eddf427ccd22db327b2fa421aaee66bd509056d..08c2626853879be6b639630f865fa8fd0d5c53a7 100644
|
| --- a/chrome/browser/password_manager/sync_metrics.cc
|
| +++ b/chrome/browser/password_manager/sync_metrics.cc
|
| @@ -14,10 +14,20 @@
|
| namespace password_manager_sync_metrics {
|
|
|
| std::string GetSyncUsername(Profile* profile) {
|
| + // If sync is set up, return early if we aren't syncing passwords.
|
| + if (ProfileSyncServiceFactory::HasProfileSyncService(profile)) {
|
| + ProfileSyncService* sync_service =
|
| + ProfileSyncServiceFactory::GetForProfile(profile);
|
| + if (!sync_service->HasSyncSetupCompleted() ||
|
| + !sync_service->GetActiveDataTypes().Has(syncer::PASSWORDS))
|
| + return std::string();
|
| + }
|
| +
|
| SigninManagerBase* signin_manager =
|
| SigninManagerFactory::GetForProfile(profile);
|
| +
|
| if (!signin_manager)
|
| - return "";
|
| + return std::string();
|
|
|
| return signin_manager->GetAuthenticatedUsername();
|
| }
|
|
|