Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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/arc/arc_auth_service.h" | 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/time/time.h" | |
| 11 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" | 12 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
| 12 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 13 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 13 #include "chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token _fetcher.h" | 14 #include "chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token _fetcher.h" |
| 14 #include "chrome/browser/chromeos/arc/auth/arc_auth_info_fetcher.h" | 15 #include "chrome/browser/chromeos/arc/auth/arc_auth_info_fetcher.h" |
| 15 #include "chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h" | 16 #include "chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h" |
| 16 #include "chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h" | 17 #include "chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h" |
| 17 #include "chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher.h" | 18 #include "chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher.h" |
| 18 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" | 19 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" |
| 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 20 #include "chrome/browser/lifetime/application_lifetime.h" | 21 #include "chrome/browser/lifetime/application_lifetime.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 ConvertArcSignInFailureReasonToProvisioningResult(reason)); | 170 ConvertArcSignInFailureReasonToProvisioningResult(reason)); |
| 170 } | 171 } |
| 171 | 172 |
| 172 void ArcAuthService::RequestAccountInfo() { | 173 void ArcAuthService::RequestAccountInfo() { |
| 173 RequestAccountInfoInternal( | 174 RequestAccountInfoInternal( |
| 174 base::MakeUnique<ArcAuthService::AccountInfoNotifier>( | 175 base::MakeUnique<ArcAuthService::AccountInfoNotifier>( |
| 175 base::Bind(&ArcAuthService::OnAccountInfoReady, | 176 base::Bind(&ArcAuthService::OnAccountInfoReady, |
| 176 weak_ptr_factory_.GetWeakPtr()))); | 177 weak_ptr_factory_.GetWeakPtr()))); |
| 177 } | 178 } |
| 178 | 179 |
| 180 void ArcAuthService::ReportMetrics(mojom::MetricsType metrics_type, | |
| 181 int32_t value) { | |
| 182 switch (metrics_type) { | |
| 183 case mojom::MetricsType::NETWORK_WAITING_TIME_MILLISECONDS: | |
| 184 UpdateAuthTiming("NetworkWaitTime", | |
|
dcheng
2017/02/23 20:12:36
I don't see Arc.Auth. prefix here, maybe wrong PS
khmel
2017/02/23 20:14:53
ArcAuth. is added at UpdateAuthTiming/UpdateAuthAt
| |
| 185 base::TimeDelta::FromMilliseconds(value)); | |
| 186 break; | |
| 187 case mojom::MetricsType::CHECKIN_ATTEMPTS: | |
| 188 UpdateAuthAttempts("CheckinAttempts", value); | |
| 189 break; | |
| 190 case mojom::MetricsType::CHECKIN_TIME_MILLISECONDS: | |
| 191 UpdateAuthTiming("CheckinTime", base::TimeDelta::FromMilliseconds(value)); | |
| 192 break; | |
| 193 case mojom::MetricsType::SIGNIN_TIME_MILLISECONDS: | |
| 194 UpdateAuthTiming("SignInTime", base::TimeDelta::FromMilliseconds(value)); | |
| 195 break; | |
| 196 } | |
| 197 } | |
| 198 | |
| 179 void ArcAuthService::OnAccountInfoReady(mojom::AccountInfoPtr account_info) { | 199 void ArcAuthService::OnAccountInfoReady(mojom::AccountInfoPtr account_info) { |
| 180 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 200 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 181 auto* instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->auth(), | 201 auto* instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->auth(), |
| 182 OnAccountInfoReady); | 202 OnAccountInfoReady); |
| 183 DCHECK(instance); | 203 DCHECK(instance); |
| 184 instance->OnAccountInfoReady(std::move(account_info)); | 204 instance->OnAccountInfoReady(std::move(account_info)); |
| 185 } | 205 } |
| 186 | 206 |
| 187 void ArcAuthService::GetAuthCodeDeprecated0( | 207 void ArcAuthService::GetAuthCodeDeprecated0( |
| 188 const GetAuthCodeDeprecated0Callback& callback) { | 208 const GetAuthCodeDeprecated0Callback& callback) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 return; | 312 return; |
| 293 } | 313 } |
| 294 | 314 |
| 295 notifier_->Notify( | 315 notifier_->Notify( |
| 296 !IsArcOptInVerificationDisabled(), auth_code, GetAccountType(), | 316 !IsArcOptInVerificationDisabled(), auth_code, GetAccountType(), |
| 297 policy_util::IsAccountManaged(ArcSessionManager::Get()->profile())); | 317 policy_util::IsAccountManaged(ArcSessionManager::Get()->profile())); |
| 298 notifier_.reset(); | 318 notifier_.reset(); |
| 299 } | 319 } |
| 300 | 320 |
| 301 } // namespace arc | 321 } // namespace arc |
| OLD | NEW |