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" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 MAP_PROVISIONING_RESULT(DEVICE_CHECK_IN_INTERNAL_ERROR); | 49 MAP_PROVISIONING_RESULT(DEVICE_CHECK_IN_INTERNAL_ERROR); |
| 50 MAP_PROVISIONING_RESULT(GMS_NETWORK_ERROR); | 50 MAP_PROVISIONING_RESULT(GMS_NETWORK_ERROR); |
| 51 MAP_PROVISIONING_RESULT(GMS_SERVICE_UNAVAILABLE); | 51 MAP_PROVISIONING_RESULT(GMS_SERVICE_UNAVAILABLE); |
| 52 MAP_PROVISIONING_RESULT(GMS_BAD_AUTHENTICATION); | 52 MAP_PROVISIONING_RESULT(GMS_BAD_AUTHENTICATION); |
| 53 MAP_PROVISIONING_RESULT(GMS_SIGN_IN_FAILED); | 53 MAP_PROVISIONING_RESULT(GMS_SIGN_IN_FAILED); |
| 54 MAP_PROVISIONING_RESULT(GMS_SIGN_IN_TIMEOUT); | 54 MAP_PROVISIONING_RESULT(GMS_SIGN_IN_TIMEOUT); |
| 55 MAP_PROVISIONING_RESULT(GMS_SIGN_IN_INTERNAL_ERROR); | 55 MAP_PROVISIONING_RESULT(GMS_SIGN_IN_INTERNAL_ERROR); |
| 56 MAP_PROVISIONING_RESULT(CLOUD_PROVISION_FLOW_FAILED); | 56 MAP_PROVISIONING_RESULT(CLOUD_PROVISION_FLOW_FAILED); |
| 57 MAP_PROVISIONING_RESULT(CLOUD_PROVISION_FLOW_TIMEOUT); | 57 MAP_PROVISIONING_RESULT(CLOUD_PROVISION_FLOW_TIMEOUT); |
| 58 MAP_PROVISIONING_RESULT(CLOUD_PROVISION_FLOW_INTERNAL_ERROR); | 58 MAP_PROVISIONING_RESULT(CLOUD_PROVISION_FLOW_INTERNAL_ERROR); |
| 59 MAP_PROVISIONING_RESULT(NO_NETWORK_CONNECTION); | |
| 59 } | 60 } |
| 60 #undef MAP_PROVISIONING_RESULT | 61 #undef MAP_PROVISIONING_RESULT |
| 61 | 62 |
| 62 NOTREACHED() << "unknown reason: " << static_cast<int>(reason); | 63 NOTREACHED() << "unknown reason: " << static_cast<int>(reason); |
| 63 return ProvisioningResult::UNKNOWN_ERROR; | 64 return ProvisioningResult::UNKNOWN_ERROR; |
| 64 } | 65 } |
| 65 | 66 |
| 66 mojom::ChromeAccountType GetAccountType() { | 67 mojom::ChromeAccountType GetAccountType() { |
| 67 return IsArcKioskMode() ? mojom::ChromeAccountType::ROBOT_ACCOUNT | 68 return IsArcKioskMode() ? mojom::ChromeAccountType::ROBOT_ACCOUNT |
| 68 : mojom::ChromeAccountType::USER_ACCOUNT; | 69 : mojom::ChromeAccountType::USER_ACCOUNT; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 UpdateAuthTiming("ArcAuth.CheckinTime", | 192 UpdateAuthTiming("ArcAuth.CheckinTime", |
| 192 base::TimeDelta::FromMilliseconds(value)); | 193 base::TimeDelta::FromMilliseconds(value)); |
| 193 break; | 194 break; |
| 194 case mojom::MetricsType::SIGNIN_TIME_MILLISECONDS: | 195 case mojom::MetricsType::SIGNIN_TIME_MILLISECONDS: |
| 195 UpdateAuthTiming("ArcAuth.SignInTime", | 196 UpdateAuthTiming("ArcAuth.SignInTime", |
| 196 base::TimeDelta::FromMilliseconds(value)); | 197 base::TimeDelta::FromMilliseconds(value)); |
| 197 break; | 198 break; |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 | 201 |
| 202 void ArcAuthService::Dummy() { | |
|
Yusuke Sato
2017/03/01 20:57:09
same, please move this up.
khmel
2017/03/01 21:33:06
Deprecated, thanks for catching this!
| |
| 203 NOTREACHED(); | |
| 204 } | |
| 205 | |
| 201 void ArcAuthService::OnAccountInfoReady(mojom::AccountInfoPtr account_info) { | 206 void ArcAuthService::OnAccountInfoReady(mojom::AccountInfoPtr account_info) { |
| 202 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 207 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 203 auto* instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->auth(), | 208 auto* instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->auth(), |
| 204 OnAccountInfoReady); | 209 OnAccountInfoReady); |
| 205 DCHECK(instance); | 210 DCHECK(instance); |
| 206 instance->OnAccountInfoReady(std::move(account_info)); | 211 instance->OnAccountInfoReady(std::move(account_info)); |
| 207 } | 212 } |
| 208 | 213 |
| 209 void ArcAuthService::GetAuthCodeDeprecated0( | 214 void ArcAuthService::GetAuthCodeDeprecated0( |
| 210 const GetAuthCodeDeprecated0Callback& callback) { | 215 const GetAuthCodeDeprecated0Callback& callback) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 return; | 319 return; |
| 315 } | 320 } |
| 316 | 321 |
| 317 notifier_->Notify( | 322 notifier_->Notify( |
| 318 !IsArcOptInVerificationDisabled(), auth_code, GetAccountType(), | 323 !IsArcOptInVerificationDisabled(), auth_code, GetAccountType(), |
| 319 policy_util::IsAccountManaged(ArcSessionManager::Get()->profile())); | 324 policy_util::IsAccountManaged(ArcSessionManager::Get()->profile())); |
| 320 notifier_.reset(); | 325 notifier_.reset(); |
| 321 } | 326 } |
| 322 | 327 |
| 323 } // namespace arc | 328 } // namespace arc |
| OLD | NEW |