| 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/shelf/shelf_delegate.h" | 9 #include "ash/shelf/shelf_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 153 } |
| 154 | 154 |
| 155 // static | 155 // static |
| 156 void ArcAuthService::RegisterProfilePrefs( | 156 void ArcAuthService::RegisterProfilePrefs( |
| 157 user_prefs::PrefRegistrySyncable* registry) { | 157 user_prefs::PrefRegistrySyncable* registry) { |
| 158 registry->RegisterBooleanPref( | 158 registry->RegisterBooleanPref( |
| 159 prefs::kArcEnabled, false, | 159 prefs::kArcEnabled, false, |
| 160 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 160 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 161 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); | 161 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); |
| 162 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, true); | 162 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, true); |
| 163 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, true); |
| 163 } | 164 } |
| 164 | 165 |
| 165 // static | 166 // static |
| 166 void ArcAuthService::DisableUIForTesting() { | 167 void ArcAuthService::DisableUIForTesting() { |
| 167 disable_ui_for_testing = true; | 168 disable_ui_for_testing = true; |
| 168 } | 169 } |
| 169 | 170 |
| 170 // static | 171 // static |
| 171 void ArcAuthService::SetShelfDelegateForTesting( | 172 void ArcAuthService::SetShelfDelegateForTesting( |
| 172 ash::ShelfDelegate* shelf_delegate) { | 173 ash::ShelfDelegate* shelf_delegate) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 !profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { | 286 !profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { |
| 286 playstore_launcher_.reset( | 287 playstore_launcher_.reset( |
| 287 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); | 288 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); |
| 288 } | 289 } |
| 289 | 290 |
| 290 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); | 291 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); |
| 291 CloseUI(); | 292 CloseUI(); |
| 292 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true, | 293 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true, |
| 293 IsAccountManaged(profile_)); | 294 IsAccountManaged(profile_)); |
| 294 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS); | 295 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS); |
| 296 |
| 297 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitialStart()); |
| 295 } | 298 } |
| 296 | 299 |
| 297 void ArcAuthService::OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) { | 300 void ArcAuthService::OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) { |
| 298 OnSignInFailedInternal( | 301 OnSignInFailedInternal( |
| 299 ConvertArcSignInFailureReasonToProvisioningResult(reason)); | 302 ConvertArcSignInFailureReasonToProvisioningResult(reason)); |
| 300 } | 303 } |
| 301 | 304 |
| 302 void ArcAuthService::OnSignInFailedInternal(ProvisioningResult result) { | 305 void ArcAuthService::OnSignInFailedInternal(ProvisioningResult result) { |
| 303 DCHECK(thread_checker.Get().CalledOnValidThread()); | 306 DCHECK(thread_checker.Get().CalledOnValidThread()); |
| 304 DCHECK_EQ(state_, State::ACTIVE); | 307 DCHECK_EQ(state_, State::ACTIVE); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 return os << kStateFetchingCode; | 797 return os << kStateFetchingCode; |
| 795 case ArcAuthService::State::ACTIVE: | 798 case ArcAuthService::State::ACTIVE: |
| 796 return os << kStateActive; | 799 return os << kStateActive; |
| 797 default: | 800 default: |
| 798 NOTREACHED(); | 801 NOTREACHED(); |
| 799 return os; | 802 return os; |
| 800 } | 803 } |
| 801 } | 804 } |
| 802 | 805 |
| 803 } // namespace arc | 806 } // namespace arc |
| OLD | NEW |