| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 // static | 149 // static |
| 150 ArcAuthService* ArcAuthService::Get() { | 150 ArcAuthService* ArcAuthService::Get() { |
| 151 DCHECK(thread_checker.Get().CalledOnValidThread()); | 151 DCHECK(thread_checker.Get().CalledOnValidThread()); |
| 152 return arc_auth_service; | 152 return arc_auth_service; |
| 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 // TODO(dspaid): Implement a mechanism to allow this to sync on first boot |
| 159 prefs::kArcEnabled, false, | 159 // only. |
| 160 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 160 registry->RegisterBooleanPref(prefs::kArcEnabled, false); |
| 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 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, true); |
| 164 } | 164 } |
| 165 | 165 |
| 166 // static | 166 // static |
| 167 void ArcAuthService::DisableUIForTesting() { | 167 void ArcAuthService::DisableUIForTesting() { |
| 168 disable_ui_for_testing = true; | 168 disable_ui_for_testing = true; |
| 169 } | 169 } |
| 170 | 170 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 UpdateEnabledStateUMA(false); | 513 UpdateEnabledStateUMA(false); |
| 514 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false); | 514 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false); |
| 515 } | 515 } |
| 516 ShutdownBridgeAndCloseUI(); | 516 ShutdownBridgeAndCloseUI(); |
| 517 } | 517 } |
| 518 | 518 |
| 519 void ArcAuthService::OnOptInPreferenceChanged() { | 519 void ArcAuthService::OnOptInPreferenceChanged() { |
| 520 DCHECK(thread_checker.Get().CalledOnValidThread()); | 520 DCHECK(thread_checker.Get().CalledOnValidThread()); |
| 521 DCHECK(profile_); | 521 DCHECK(profile_); |
| 522 | 522 |
| 523 // TODO(dspaid): Move code from OnSyncedPrefChanged into this method. |
| 524 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged()); |
| 525 |
| 523 const bool arc_enabled = IsArcEnabled(); | 526 const bool arc_enabled = IsArcEnabled(); |
| 524 FOR_EACH_OBSERVER(Observer, observer_list_, OnOptInEnabled(arc_enabled)); | 527 FOR_EACH_OBSERVER(Observer, observer_list_, OnOptInEnabled(arc_enabled)); |
| 525 | 528 |
| 526 if (!arc_enabled) { | 529 if (!arc_enabled) { |
| 527 StopArc(); | 530 StopArc(); |
| 528 return; | 531 return; |
| 529 } | 532 } |
| 530 | 533 |
| 531 if (state_ == State::ACTIVE) | 534 if (state_ == State::ACTIVE) |
| 532 return; | 535 return; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 return os << kStateFetchingCode; | 802 return os << kStateFetchingCode; |
| 800 case ArcAuthService::State::ACTIVE: | 803 case ArcAuthService::State::ACTIVE: |
| 801 return os << kStateActive; | 804 return os << kStateActive; |
| 802 default: | 805 default: |
| 803 NOTREACHED(); | 806 NOTREACHED(); |
| 804 return os; | 807 return os; |
| 805 } | 808 } |
| 806 } | 809 } |
| 807 | 810 |
| 808 } // namespace arc | 811 } // namespace arc |
| OLD | NEW |