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

Side by Side Diff: chrome/browser/chromeos/login/reauth_stats.cc

Issue 1534173003: ChromeOS user_manager: move all KnownUser code to separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/FindUsingSAML/IsUsingSAML/ Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/reauth_stats.h" 5 #include "chrome/browser/chromeos/login/reauth_stats.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "components/user_manager/user_manager.h" 8 #include "components/user_manager/known_user.h"
9 9
10 namespace chromeos { 10 namespace chromeos {
11 11
12 void RecordReauthReason(const AccountId& account_id, ReauthReason reason) { 12 void RecordReauthReason(const AccountId& account_id, ReauthReason reason) {
13 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
14 int old_reason; 13 int old_reason;
15 // We record only the first value, skipping everything else, except "none" 14 // We record only the first value, skipping everything else, except "none"
16 // value, which is used to reset the current state. 15 // value, which is used to reset the current state.
17 if (!user_manager->FindReauthReason(account_id, &old_reason) || 16 if (!user_manager::known_user::FindReauthReason(account_id, &old_reason) ||
18 (static_cast<ReauthReason>(old_reason) == ReauthReason::NONE && 17 (static_cast<ReauthReason>(old_reason) == ReauthReason::NONE &&
19 reason != ReauthReason::NONE)) { 18 reason != ReauthReason::NONE)) {
20 user_manager->UpdateReauthReason(account_id, static_cast<int>(reason)); 19 user_manager::known_user::UpdateReauthReason(account_id,
20 static_cast<int>(reason));
21 } 21 }
22 } 22 }
23 23
24 void SendReauthReason(const AccountId& account_id) { 24 void SendReauthReason(const AccountId& account_id) {
25 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
26 int reauth_reason; 25 int reauth_reason;
27 if (user_manager->FindReauthReason(account_id, &reauth_reason) && 26 if (user_manager::known_user::FindReauthReason(account_id, &reauth_reason) &&
28 static_cast<ReauthReason>(reauth_reason) != ReauthReason::NONE) { 27 static_cast<ReauthReason>(reauth_reason) != ReauthReason::NONE) {
29 UMA_HISTOGRAM_ENUMERATION("Login.ReauthReason", reauth_reason, 28 UMA_HISTOGRAM_ENUMERATION("Login.ReauthReason", reauth_reason,
30 NUM_REAUTH_FLOW_REASONS); 29 NUM_REAUTH_FLOW_REASONS);
31 user_manager->UpdateReauthReason(account_id, 30 user_manager::known_user::UpdateReauthReason(
32 static_cast<int>(ReauthReason::NONE)); 31 account_id, static_cast<int>(ReauthReason::NONE));
33 } 32 }
34 } 33 }
35 34
36 } // namespace chromeos 35 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698