forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Landing https://codereview.chromium.org/1114543002/ BUG=469992 TBR=isherman@chromium.org Review URL: https://codereview.chromium.org/1132523002 Cr-Commit-Position: refs/heads/master@{#328858}
- Loading branch information
nkostylev
authored and
Commit bot
committed
May 7, 2015
1 parent
179b32c
commit eb9ce0d
Showing
16 changed files
with
319 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// 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. | ||
|
||
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_REAUTH_STATS_H_ | ||
#define CHROME_BROWSER_CHROMEOS_LOGIN_REAUTH_STATS_H_ | ||
|
||
#include <string> | ||
|
||
namespace chromeos { | ||
|
||
// Track all the ways a user may be sent through the re-auth flow. | ||
// This enum is used to define the buckets for an enumerated UMA histogram. | ||
// Hence, existing enumerated constants should never be reordered, and all new | ||
// constants should only be appended at the end of the enumeration. | ||
enum ReauthReason { | ||
// Default value: no reauth reasons were detected so far, or the reason was | ||
// already reported. | ||
NONE = 0, | ||
|
||
// Legacy profile holders. | ||
OTHER = 1, | ||
|
||
// Password changed, revoked credentials, account deleted. | ||
INVALID_TOKEN_HANDLE = 2, | ||
|
||
// Incorrect password entered 3 times at the user pod. | ||
INCORRECT_PASSWORD_ENTERED = 3, | ||
|
||
// Incorrect password entered by a SAML user once. | ||
// OS would show a tooltip offering user to complete the online sign-in. | ||
INCORRECT_SAML_PASSWORD_ENTERED = 4, | ||
|
||
// Device policy is set not to show user pods, which requires re-auth on every | ||
// login. | ||
SAML_REAUTH_POLICY = 5, | ||
|
||
// Cryptohome is missing, most likely due to deletion during garbage | ||
// collection. | ||
MISSING_CRYPTOHOME = 6, | ||
|
||
// During last login OS failed to connect to the sync with the existing RT. | ||
// This could be due to account deleted, password changed, account revoked, | ||
// etc. | ||
SYNC_FAILED = 7, | ||
|
||
// User cancelled the password change prompt when prompted by Chrome OS. | ||
PASSWORD_UPDATE_SKIPPED = 8, | ||
|
||
// Must be the last value in this list. | ||
NUM_REAUTH_FLOW_REASONS, | ||
}; | ||
|
||
void RecordReauthReason(const std::string& user_id, ReauthReason reason); | ||
void SendReauthReason(const std::string& user_id); | ||
|
||
} // namespace chromeos | ||
|
||
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_REAUTH_STATS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.