| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 if (!IsOptInVerificationDisabled() && | 325 if (!IsOptInVerificationDisabled() && |
| 326 !profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { | 326 !profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { |
| 327 playstore_launcher_.reset( | 327 playstore_launcher_.reset( |
| 328 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); | 328 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); |
| 329 } | 329 } |
| 330 | 330 |
| 331 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); | 331 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); |
| 332 CloseUI(); | 332 CloseUI(); |
| 333 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true, | 333 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true, |
| 334 IsAccountManaged(profile_)); | 334 IsAccountManaged(profile_)); |
| 335 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS); | 335 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS, |
| 336 IsAccountManaged(profile_)); |
| 336 | 337 |
| 337 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitialStart()); | 338 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitialStart()); |
| 338 } | 339 } |
| 339 | 340 |
| 340 void ArcAuthService::OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) { | 341 void ArcAuthService::OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) { |
| 341 OnSignInFailedInternal( | 342 OnSignInFailedInternal( |
| 342 ConvertArcSignInFailureReasonToProvisioningResult(reason)); | 343 ConvertArcSignInFailureReasonToProvisioningResult(reason)); |
| 343 } | 344 } |
| 344 | 345 |
| 345 void ArcAuthService::OnSignInFailedInternal(ProvisioningResult result) { | 346 void ArcAuthService::OnSignInFailedInternal(ProvisioningResult result) { |
| 346 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 347 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 347 DCHECK_EQ(state_, State::ACTIVE); | 348 DCHECK_EQ(state_, State::ACTIVE); |
| 348 DCHECK(!sign_in_time_.is_null()); | 349 DCHECK(!sign_in_time_.is_null()); |
| 349 | 350 |
| 350 arc_sign_in_timer_.Stop(); | 351 arc_sign_in_timer_.Stop(); |
| 351 | 352 |
| 352 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, false, | 353 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, false, |
| 353 IsAccountManaged(profile_)); | 354 IsAccountManaged(profile_)); |
| 354 UpdateOptInCancelUMA(OptInCancelReason::CLOUD_PROVISION_FLOW_FAIL); | 355 UpdateOptInCancelUMA(OptInCancelReason::CLOUD_PROVISION_FLOW_FAIL); |
| 355 UpdateProvisioningResultUMA(result); | 356 UpdateProvisioningResultUMA(result, IsAccountManaged(profile_)); |
| 356 | 357 |
| 357 int error_message_id; | 358 int error_message_id; |
| 358 switch (result) { | 359 switch (result) { |
| 359 case ProvisioningResult::GMS_NETWORK_ERROR: | 360 case ProvisioningResult::GMS_NETWORK_ERROR: |
| 360 error_message_id = IDS_ARC_SIGN_IN_NETWORK_ERROR; | 361 error_message_id = IDS_ARC_SIGN_IN_NETWORK_ERROR; |
| 361 break; | 362 break; |
| 362 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE: | 363 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE: |
| 363 case ProvisioningResult::GMS_SIGN_IN_FAILED: | 364 case ProvisioningResult::GMS_SIGN_IN_FAILED: |
| 364 case ProvisioningResult::GMS_SIGN_IN_TIMEOUT: | 365 case ProvisioningResult::GMS_SIGN_IN_TIMEOUT: |
| 365 case ProvisioningResult::GMS_SIGN_IN_INTERNAL_ERROR: | 366 case ProvisioningResult::GMS_SIGN_IN_INTERNAL_ERROR: |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 return os << kStateFetchingCode; | 908 return os << kStateFetchingCode; |
| 908 case ArcAuthService::State::ACTIVE: | 909 case ArcAuthService::State::ACTIVE: |
| 909 return os << kStateActive; | 910 return os << kStateActive; |
| 910 default: | 911 default: |
| 911 NOTREACHED(); | 912 NOTREACHED(); |
| 912 return os; | 913 return os; |
| 913 } | 914 } |
| 914 } | 915 } |
| 915 | 916 |
| 916 } // namespace arc | 917 } // namespace arc |
| OLD | NEW |