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

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

Issue 2302823003: Only report PasswordState in Sync for UMA+non-custom passphrase users. (Closed)
Patch Set: Split apart state-transition test Created 4 years, 3 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/chrome_password_manager_client.cc
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
index d4b0cb4cbdb7b106865ab44f8e905fa3e8c83b3d..78b41cb82b5aab32ec5d8fcb0a4c19661241b889 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -15,6 +15,7 @@
#include "base/metrics/histogram.h"
#include "build/build_config.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
+#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager_factory.h"
@@ -574,8 +575,29 @@ const GURL& ChromePasswordManagerClient::GetLastCommittedEntryURL() const {
return entry->GetURL();
}
+// static
+bool ChromePasswordManagerClient::ShouldAnnotateNavigationEntries(
+ Profile* profile) {
+ // Only annotate PasswordState onto the navigation entry if user is
+ // opted into UMA and they're not syncing w/ a custom passphrase.
+ if (!ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled())
+ return false;
+
+ ProfileSyncService* profile_sync_service =
+ ProfileSyncServiceFactory::GetForProfile(profile);
+ if (!profile_sync_service || !profile_sync_service->IsSyncActive() ||
+ profile_sync_service->IsUsingSecondaryPassphrase()) {
+ return false;
+ }
+
+ return true;
+}
+
void ChromePasswordManagerClient::AnnotateNavigationEntry(
bool has_password_field) {
+ if (!ShouldAnnotateNavigationEntries(profile_))
+ return;
+
content::NavigationEntry* entry =
web_contents()->GetController().GetLastCommittedEntry();
if (!entry)

Powered by Google App Engine
This is Rietveld 408576698