| 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 "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if (!IsOptInVerificationDisabled() && | 324 if (!IsOptInVerificationDisabled() && |
| 325 !profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { | 325 !profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { |
| 326 playstore_launcher_.reset( | 326 playstore_launcher_.reset( |
| 327 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); | 327 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); |
| 328 } | 328 } |
| 329 | 329 |
| 330 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); | 330 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); |
| 331 CloseUI(); | 331 CloseUI(); |
| 332 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true, | 332 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true, |
| 333 IsAccountManaged(profile_)); | 333 IsAccountManaged(profile_)); |
| 334 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS); | 334 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS, |
| 335 IsAccountManaged(profile_)); |
| 335 | 336 |
| 336 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitialStart()); | 337 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitialStart()); |
| 337 } | 338 } |
| 338 | 339 |
| 339 void ArcAuthService::OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) { | 340 void ArcAuthService::OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) { |
| 340 OnSignInFailedInternal( | 341 OnSignInFailedInternal( |
| 341 ConvertArcSignInFailureReasonToProvisioningResult(reason)); | 342 ConvertArcSignInFailureReasonToProvisioningResult(reason)); |
| 342 } | 343 } |
| 343 | 344 |
| 344 void ArcAuthService::OnSignInFailedInternal(ProvisioningResult result) { | 345 void ArcAuthService::OnSignInFailedInternal(ProvisioningResult result) { |
| 345 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 346 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 346 DCHECK_EQ(state_, State::ACTIVE); | 347 DCHECK_EQ(state_, State::ACTIVE); |
| 347 DCHECK(!sign_in_time_.is_null()); | 348 DCHECK(!sign_in_time_.is_null()); |
| 348 | 349 |
| 349 arc_sign_in_timer_.Stop(); | 350 arc_sign_in_timer_.Stop(); |
| 350 | 351 |
| 351 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, false, | 352 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, false, |
| 352 IsAccountManaged(profile_)); | 353 IsAccountManaged(profile_)); |
| 353 UpdateOptInCancelUMA(OptInCancelReason::CLOUD_PROVISION_FLOW_FAIL); | 354 UpdateOptInCancelUMA(OptInCancelReason::CLOUD_PROVISION_FLOW_FAIL); |
| 354 UpdateProvisioningResultUMA(result); | 355 UpdateProvisioningResultUMA(result, IsAccountManaged(profile_)); |
| 355 | 356 |
| 356 int error_message_id; | 357 int error_message_id; |
| 357 switch (result) { | 358 switch (result) { |
| 358 case ProvisioningResult::GMS_NETWORK_ERROR: | 359 case ProvisioningResult::GMS_NETWORK_ERROR: |
| 359 error_message_id = IDS_ARC_SIGN_IN_NETWORK_ERROR; | 360 error_message_id = IDS_ARC_SIGN_IN_NETWORK_ERROR; |
| 360 break; | 361 break; |
| 361 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE: | 362 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE: |
| 362 case ProvisioningResult::GMS_SIGN_IN_FAILED: | 363 case ProvisioningResult::GMS_SIGN_IN_FAILED: |
| 363 case ProvisioningResult::GMS_SIGN_IN_TIMEOUT: | 364 case ProvisioningResult::GMS_SIGN_IN_TIMEOUT: |
| 364 case ProvisioningResult::GMS_SIGN_IN_INTERNAL_ERROR: | 365 case ProvisioningResult::GMS_SIGN_IN_INTERNAL_ERROR: |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 return os << kStateFetchingCode; | 877 return os << kStateFetchingCode; |
| 877 case ArcAuthService::State::ACTIVE: | 878 case ArcAuthService::State::ACTIVE: |
| 878 return os << kStateActive; | 879 return os << kStateActive; |
| 879 default: | 880 default: |
| 880 NOTREACHED(); | 881 NOTREACHED(); |
| 881 return os; | 882 return os; |
| 882 } | 883 } |
| 883 } | 884 } |
| 884 | 885 |
| 885 } // namespace arc | 886 } // namespace arc |
| OLD | NEW |