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

Unified Diff: chrome/browser/ui/passwords/password_manager_presenter.cc

Issue 355143006: [Password Manager] Add UMA stats to track interaction with synced accounts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/ui/passwords/password_manager_presenter.cc
diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc
index a8d96a7f1fdba7d90f95743443d5cc3103ba6e9d..331e1384fbe72d71801e125072772e889472c198 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -6,11 +6,14 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/metrics/user_metrics_action.h"
#include "base/prefs/pref_service.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/password_manager/password_manager_util.h"
#include "chrome/browser/password_manager/password_store_factory.h"
+#include "chrome/browser/password_manager/sync_metrics.h"
#include "chrome/browser/ui/passwords/password_ui_view.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
@@ -18,6 +21,8 @@
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
+#include "google_apis/gaia/gaia_auth_util.h"
+#include "google_apis/gaia/gaia_urls.h"
using password_manager::PasswordStore;
@@ -125,6 +130,20 @@ void PasswordManagerPresenter::RequestShowPassword(size_t index) {
else
return;
}
+
+ std::string sync_username;
+ password_manager::SyncState sync_state;
+ password_manager_sync_metrics::GetSyncUsernameAndState(
+ password_view_->GetProfile(), &sync_username, &sync_state);
+
+ if ((password_list_[index]->signon_realm ==
+ GaiaUrls::GetInstance()->gaia_url().GetOrigin().spec()) &&
+ gaia::AreEmailsSame(UTF16ToUTF8(password_list_[index]->username_value),
+ sync_username)) {
+ content::RecordAction(
+ base::UserMetricsAction("PasswordManager_SyncCredentialShown"));
+ }
+
// Call back the front end to reveal the password.
password_view_->ShowPassword(index, password_list_[index]->password_value);
#endif

Powered by Google App Engine
This is Rietveld 408576698