| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/login/startup_utils.h" | 5 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 namespace chromeos { | 81 namespace chromeos { |
| 82 | 82 |
| 83 // static | 83 // static |
| 84 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { | 84 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { |
| 85 registry->RegisterBooleanPref(prefs::kOobeComplete, false); | 85 registry->RegisterBooleanPref(prefs::kOobeComplete, false); |
| 86 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); | 86 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); |
| 87 registry->RegisterBooleanPref(prefs::kOobeMdMode, false); | 87 registry->RegisterBooleanPref(prefs::kOobeMdMode, false); |
| 88 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); | 88 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); |
| 89 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); | 89 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); |
| 90 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); | 90 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); |
| 91 registry->RegisterStringPref(prefs::kOobeBootstrappingRole, ""); |
| 91 registry->RegisterBooleanPref(prefs::kOobeControllerDetected, false); | 92 registry->RegisterBooleanPref(prefs::kOobeControllerDetected, false); |
| 92 } | 93 } |
| 93 | 94 |
| 94 // static | 95 // static |
| 95 bool StartupUtils::IsEulaAccepted() { | 96 bool StartupUtils::IsEulaAccepted() { |
| 96 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); | 97 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); |
| 97 } | 98 } |
| 98 | 99 |
| 99 // static | 100 // static |
| 100 bool StartupUtils::IsOobeCompleted() { | 101 bool StartupUtils::IsOobeCompleted() { |
| 101 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete); | 102 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete); |
| 102 } | 103 } |
| 103 | 104 |
| 104 // static | 105 // static |
| 105 void StartupUtils::MarkEulaAccepted() { | 106 void StartupUtils::MarkEulaAccepted() { |
| 106 SaveBoolPreferenceForced(prefs::kEulaAccepted, true); | 107 SaveBoolPreferenceForced(prefs::kEulaAccepted, true); |
| 107 } | 108 } |
| 108 | 109 |
| 109 // static | 110 // static |
| 110 void StartupUtils::MarkOobeCompleted() { | 111 void StartupUtils::MarkOobeCompleted() { |
| 111 // Forcing the second pref will force this one as well. Even if this one | 112 // Forcing the second pref will force this one as well. Even if this one |
| 112 // doesn't end up synced it is only going to eat up a couple of bytes with no | 113 // doesn't end up synced it is only going to eat up a couple of bytes with no |
| 113 // side-effects. | 114 // side-effects. |
| 114 g_browser_process->local_state()->ClearPref(prefs::kOobeScreenPending); | 115 g_browser_process->local_state()->ClearPref(prefs::kOobeScreenPending); |
| 115 SaveBoolPreferenceForced(prefs::kOobeComplete, true); | 116 SaveBoolPreferenceForced(prefs::kOobeComplete, true); |
| 116 | 117 |
| 118 g_browser_process->local_state()->ClearPref(prefs::kOobeBootstrappingRole); |
| 119 |
| 117 // Successful enrollment implies that recovery is not required. | 120 // Successful enrollment implies that recovery is not required. |
| 118 SaveBoolPreferenceForced(prefs::kEnrollmentRecoveryRequired, false); | 121 SaveBoolPreferenceForced(prefs::kEnrollmentRecoveryRequired, false); |
| 119 } | 122 } |
| 120 | 123 |
| 121 // static | 124 // static |
| 122 void StartupUtils::SaveOobePendingScreen(const std::string& screen) { | 125 void StartupUtils::SaveOobePendingScreen(const std::string& screen) { |
| 123 SaveStringPreferenceForced(prefs::kOobeScreenPending, screen); | 126 SaveStringPreferenceForced(prefs::kOobeScreenPending, screen); |
| 124 } | 127 } |
| 125 | 128 |
| 126 // static | 129 // static |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 197 |
| 195 // static | 198 // static |
| 196 void StartupUtils::SetInitialLocale(const std::string& locale) { | 199 void StartupUtils::SetInitialLocale(const std::string& locale) { |
| 197 if (l10n_util::IsValidLocaleSyntax(locale)) | 200 if (l10n_util::IsValidLocaleSyntax(locale)) |
| 198 SaveStringPreferenceForced(prefs::kInitialLocale, locale); | 201 SaveStringPreferenceForced(prefs::kInitialLocale, locale); |
| 199 else | 202 else |
| 200 NOTREACHED(); | 203 NOTREACHED(); |
| 201 } | 204 } |
| 202 | 205 |
| 203 } // namespace chromeos | 206 } // namespace chromeos |
| OLD | NEW |