| 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" |
| 11 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/extensions/features/feature_channel.h" | |
| 19 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 20 #include "chromeos/chromeos_switches.h" | 19 #include "chromeos/chromeos_switches.h" |
| 21 #include "components/web_resource/web_resource_pref_names.h" | 20 #include "components/web_resource/web_resource_pref_names.h" |
| 22 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 24 | 23 |
| 25 using content::BrowserThread; | 24 using content::BrowserThread; |
| 26 | 25 |
| 27 namespace { | 26 namespace { |
| 28 | 27 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 52 | 51 |
| 53 namespace chromeos { | 52 namespace chromeos { |
| 54 | 53 |
| 55 // static | 54 // static |
| 56 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { | 55 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { |
| 57 registry->RegisterBooleanPref(prefs::kOobeComplete, false); | 56 registry->RegisterBooleanPref(prefs::kOobeComplete, false); |
| 58 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); | 57 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); |
| 59 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); | 58 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); |
| 60 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); | 59 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); |
| 61 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); | 60 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); |
| 62 registry->RegisterBooleanPref(prefs::kNewOobe, false); | |
| 63 registry->RegisterBooleanPref(prefs::kWebviewSigninDisabled, false); | 61 registry->RegisterBooleanPref(prefs::kWebviewSigninDisabled, false); |
| 64 registry->RegisterBooleanPref(prefs::kNewLoginUIPopup, false); | 62 registry->RegisterBooleanPref(prefs::kNewLoginUIPopup, false); |
| 65 } | 63 } |
| 66 | 64 |
| 67 // static | 65 // static |
| 68 bool StartupUtils::IsEulaAccepted() { | 66 bool StartupUtils::IsEulaAccepted() { |
| 69 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); | 67 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); |
| 70 } | 68 } |
| 71 | 69 |
| 72 // static | 70 // static |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 218 } |
| 221 | 219 |
| 222 // static | 220 // static |
| 223 void StartupUtils::SetInitialLocale(const std::string& locale) { | 221 void StartupUtils::SetInitialLocale(const std::string& locale) { |
| 224 if (l10n_util::IsValidLocaleSyntax(locale)) | 222 if (l10n_util::IsValidLocaleSyntax(locale)) |
| 225 SaveStringPreferenceForced(prefs::kInitialLocale, locale); | 223 SaveStringPreferenceForced(prefs::kInitialLocale, locale); |
| 226 else | 224 else |
| 227 NOTREACHED(); | 225 NOTREACHED(); |
| 228 } | 226 } |
| 229 | 227 |
| 230 // static | |
| 231 bool StartupUtils::IsNewOobeAllowed() { | |
| 232 return extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV; | |
| 233 } | |
| 234 | |
| 235 // static | |
| 236 bool StartupUtils::IsNewOobeActivated() { | |
| 237 return g_browser_process->local_state()->GetBoolean(prefs::kNewOobe) && | |
| 238 IsNewOobeAllowed(); | |
| 239 } | |
| 240 | |
| 241 } // namespace chromeos | 228 } // namespace chromeos |
| OLD | NEW |