Index: chrome/browser/chromeos/arc/arc_auth_service.cc |
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc |
index 989f1a6907e3b85aae16e129fba043762d12480e..06457881f23bf4847d2ce4cd6e6001d52a1ebd20 100644 |
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc |
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc |
@@ -90,6 +90,7 @@ class ArcAuthService::AccountInfoNotifier { |
void Notify(bool is_enforced, |
const std::string& auth_info, |
+ const std::string& account_name, |
mojom::ChromeAccountType account_type, |
bool is_managed) { |
switch (callback_type_) { |
@@ -104,6 +105,7 @@ class ArcAuthService::AccountInfoNotifier { |
case CallbackType::ACCOUNT_INFO: |
DCHECK(!account_info_callback_.is_null()); |
mojom::AccountInfoPtr account_info = mojom::AccountInfo::New(); |
+ account_info->account_name = account_name; |
if (account_type == |
mojom::ChromeAccountType::ACTIVE_DIRECTORY_ACCOUNT) { |
account_info->enrollment_token = auth_info; |
@@ -195,6 +197,33 @@ void ArcAuthService::ReportMetrics(mojom::MetricsType metrics_type, |
UpdateAuthTiming("ArcAuth.SignInTime", |
base::TimeDelta::FromMilliseconds(value)); |
break; |
+ case mojom::MetricsType::ACCOUNT_CHECK_MILLISECONDS: |
+ UpdateAuthTiming("ArcAuth.AccountCheckTime", |
+ base::TimeDelta::FromMilliseconds(value)); |
+ break; |
+ } |
+} |
+ |
+void ArcAuthService::ReportAccountCheckStatus( |
+ mojom::AccountCheckStatus status) { |
+ switch (status) { |
+ case mojom::AccountCheckStatus::UP_TO_DATE: |
+ UpdateAuthAccountCheckStatus(AccountCheckStatus::UP_TO_DATE); |
+ break; |
+ case mojom::AccountCheckStatus::NEW: |
+ UpdateAuthAccountCheckStatus(AccountCheckStatus::NEW); |
+ break; |
+ case mojom::AccountCheckStatus::NEED_REAUTH: |
+ UpdateAuthAccountCheckStatus(AccountCheckStatus::NEED_REAUTH); |
+ break; |
+ case mojom::AccountCheckStatus::UNKNOWN: |
+ UpdateAuthAccountCheckStatus(AccountCheckStatus::UNKNOWN); |
+ break; |
+ case mojom::AccountCheckStatus::CHECK_FAILED: |
+ UpdateAuthAccountCheckStatus(AccountCheckStatus::CHECK_FAILED); |
+ break; |
+ default: |
+ NOTREACHED() << "Unknown account check status"; |
dcheng
2017/03/25 00:55:04
Please typemap this enum instead =)
(Or just use
khmel
2017/03/25 01:24:14
Not sure if I got you correctly. I added << status
|
} |
} |
@@ -243,7 +272,8 @@ void ArcAuthService::RequestAccountInfoInternal( |
if (IsArcOptInVerificationDisabled()) { |
notifier->Notify( |
- false /* = is_enforced */, std::string(), GetAccountType(), |
+ false /* = is_enforced */, std::string() /* auth_info */, |
+ std::string() /* auth_name */, GetAccountType(), |
policy_util::IsAccountManaged(ArcSessionManager::Get()->profile())); |
return; |
} |
@@ -255,6 +285,7 @@ void ArcAuthService::RequestAccountInfoInternal( |
const user_manager::User* user = nullptr; |
if (profile) |
user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
+ |
if (user && user->IsActiveDirectoryUser()) { |
// For Active Directory enrolled devices, we get an enrollment token for a |
// managed Google Play account from DMServer. |
@@ -297,6 +328,7 @@ void ArcAuthService::OnEnrollmentTokenFetched( |
switch (status) { |
case ArcAuthInfoFetcher::Status::SUCCESS: |
notifier_->Notify(true /*is_enforced*/, enrollment_token, |
+ std::string() /* account_name */, |
mojom::ChromeAccountType::ACTIVE_DIRECTORY_ACCOUNT, |
true); |
notifier_.reset(); |
@@ -324,7 +356,9 @@ void ArcAuthService::OnAuthCodeFetched(ArcAuthInfoFetcher::Status status, |
} |
notifier_->Notify( |
- !IsArcOptInVerificationDisabled(), auth_code, GetAccountType(), |
+ !IsArcOptInVerificationDisabled(), auth_code, |
+ ArcSessionManager::Get()->auth_context()->full_account_id(), |
+ GetAccountType(), |
policy_util::IsAccountManaged(ArcSessionManager::Get()->profile())); |
notifier_.reset(); |
} |