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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 | 146 |
147 // static | 147 // static |
148 ArcAuthService* ArcAuthService::Get() { | 148 ArcAuthService* ArcAuthService::Get() { |
149 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 149 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
150 return g_arc_auth_service; | 150 return g_arc_auth_service; |
151 } | 151 } |
152 | 152 |
153 // static | 153 // static |
154 void ArcAuthService::RegisterProfilePrefs( | 154 void ArcAuthService::RegisterProfilePrefs( |
155 user_prefs::PrefRegistrySyncable* registry) { | 155 user_prefs::PrefRegistrySyncable* registry) { |
156 registry->RegisterBooleanPref( | 156 registry->RegisterBooleanPref(prefs::kArcEnabled, false); |
khmel
2016/08/09 15:25:48
Please add // TODO(): ...
dspaid
2016/08/09 23:25:07
Done.
| |
157 prefs::kArcEnabled, false, | |
158 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | |
159 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); | 157 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); |
160 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, true); | 158 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, true); |
161 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, true); | 159 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, true); |
162 } | 160 } |
163 | 161 |
164 // static | 162 // static |
165 void ArcAuthService::DisableUIForTesting() { | 163 void ArcAuthService::DisableUIForTesting() { |
166 g_disable_ui_for_testing = true; | 164 g_disable_ui_for_testing = true; |
167 } | 165 } |
168 | 166 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 UpdateEnabledStateUMA(false); | 510 UpdateEnabledStateUMA(false); |
513 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false); | 511 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false); |
514 } | 512 } |
515 ShutdownBridgeAndCloseUI(); | 513 ShutdownBridgeAndCloseUI(); |
516 } | 514 } |
517 | 515 |
518 void ArcAuthService::OnOptInPreferenceChanged() { | 516 void ArcAuthService::OnOptInPreferenceChanged() { |
519 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 517 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
520 DCHECK(profile_); | 518 DCHECK(profile_); |
521 | 519 |
520 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged()); | |
khmel
2016/08/09 15:25:48
Please add // TODO(): ...
dspaid
2016/08/09 23:25:07
Done.
| |
521 | |
522 const bool arc_enabled = IsArcEnabled(); | 522 const bool arc_enabled = IsArcEnabled(); |
523 FOR_EACH_OBSERVER(Observer, observer_list_, OnOptInEnabled(arc_enabled)); | 523 FOR_EACH_OBSERVER(Observer, observer_list_, OnOptInEnabled(arc_enabled)); |
524 | 524 |
525 if (!arc_enabled) { | 525 if (!arc_enabled) { |
526 StopArc(); | 526 StopArc(); |
527 return; | 527 return; |
528 } | 528 } |
529 | 529 |
530 if (state_ == State::ACTIVE) | 530 if (state_ == State::ACTIVE) |
531 return; | 531 return; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
806 return os << kStateFetchingCode; | 806 return os << kStateFetchingCode; |
807 case ArcAuthService::State::ACTIVE: | 807 case ArcAuthService::State::ACTIVE: |
808 return os << kStateActive; | 808 return os << kStateActive; |
809 default: | 809 default: |
810 NOTREACHED(); | 810 NOTREACHED(); |
811 return os; | 811 return os; |
812 } | 812 } |
813 } | 813 } |
814 | 814 |
815 } // namespace arc | 815 } // namespace arc |
OLD | NEW |