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

Unified Diff: chrome/browser/chromeos/login/reauth_stats.cc

Issue 1114543002: UMA to track the reason for re-auth (draft). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fixes. Created 5 years, 8 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/chromeos/login/reauth_stats.cc
diff --git a/chrome/browser/chromeos/login/reauth_stats.cc b/chrome/browser/chromeos/login/reauth_stats.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f442c974f012efa6401590731e93e96e03bdffe0
--- /dev/null
+++ b/chrome/browser/chromeos/login/reauth_stats.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/login/reauth_stats.h"
+
+#include "base/metrics/histogram_macros.h"
+#include "components/user_manager/user_manager.h"
+
+namespace chromeos {
+
+void RecordReauthReason(const std::string& user_id, ReauthReason reason) {
+ user_manager::UserManager* user_manager = user_manager::UserManager::Get();
+ int old_reason;
+ // We record only the first value, skipping everything else, except "none"
+ // value, which is used to reset the current state.
+ if (!user_manager->FindReauthReason(user_id, &old_reason) ||
+ (static_cast<ReauthReason>(old_reason) == ReauthReason::NONE &&
+ reason != ReauthReason::NONE)) {
+ user_manager->UpdateReauthReason(user_id, static_cast<int>(reason));
+ }
+}
+
+void SendReauthReason(const std::string& user_id) {
+ user_manager::UserManager* user_manager = user_manager::UserManager::Get();
+ int reauth_reason;
+ if (user_manager->FindReauthReason(user_id, &reauth_reason) &&
+ static_cast<ReauthReason>(reauth_reason) != ReauthReason::NONE) {
+ UMA_HISTOGRAM_ENUMERATION("Login.ReauthReason", reauth_reason,
+ NUM_REAUTH_FLOW_REASONS);
+ user_manager->UpdateReauthReason(user_id,
+ static_cast<int>(ReauthReason::NONE));
+ }
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/reauth_stats.h ('k') | chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698