Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7386)

Unified Diff: chrome/browser/password_manager/sync_metrics.cc

Issue 451853003: [Password Manager] Setup experiment to restrict autofilling of sync credential (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unittest fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..304bb6d92954ef2d4e4b11df73cdf10adb9550b4 100644
--- a/chrome/browser/password_manager/sync_metrics.cc
+++ b/chrome/browser/password_manager/sync_metrics.cc
@@ -14,10 +14,19 @@
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->GetPreferredDataTypes().Has(syncer::PASSWORDS))
+ return std::string();
+ }
+
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile);
+
if (!signin_manager)
- return "";
+ return std::string();
return signin_manager->GetAuthenticatedUsername();
}
« no previous file with comments | « chrome/browser/password_manager/sync_metrics.h ('k') | components/password_manager/core/browser/password_form_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698