Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 prefs->CommitPendingWrite(); | 32 prefs->CommitPendingWrite(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // Saves integer "Local State" preference and forces its persistence to disk. | 35 // Saves integer "Local State" preference and forces its persistence to disk. |
| 36 void SaveIntegerPreferenceForced(const char* pref_name, int value) { | 36 void SaveIntegerPreferenceForced(const char* pref_name, int value) { |
| 37 PrefService* prefs = g_browser_process->local_state(); | 37 PrefService* prefs = g_browser_process->local_state(); |
| 38 prefs->SetInteger(pref_name, value); | 38 prefs->SetInteger(pref_name, value); |
| 39 prefs->CommitPendingWrite(); | 39 prefs->CommitPendingWrite(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Saves 64 bit signed integer "Local State" preference and forces its | |
| 43 // persistence to disk. | |
| 44 void SaveInt64PreferenceForced(const char* pref_name, int64_t value) { | |
| 45 PrefService* prefs = g_browser_process->local_state(); | |
| 46 prefs->SetInt64(pref_name, value); | |
| 47 prefs->CommitPendingWrite(); | |
| 48 } | |
| 49 | |
| 42 // Saves string "Local State" preference and forces its persistence to disk. | 50 // Saves string "Local State" preference and forces its persistence to disk. |
| 43 void SaveStringPreferenceForced(const char* pref_name, | 51 void SaveStringPreferenceForced(const char* pref_name, |
| 44 const std::string& value) { | 52 const std::string& value) { |
| 45 PrefService* prefs = g_browser_process->local_state(); | 53 PrefService* prefs = g_browser_process->local_state(); |
| 46 prefs->SetString(pref_name, value); | 54 prefs->SetString(pref_name, value); |
| 47 prefs->CommitPendingWrite(); | 55 prefs->CommitPendingWrite(); |
| 48 } | 56 } |
| 49 | 57 |
| 50 // Returns the path to flag file indicating that both parts of OOBE were | 58 // Returns the path to flag file indicating that both parts of OOBE were |
| 51 // completed. | 59 // completed. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 82 | 90 |
| 83 // static | 91 // static |
| 84 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { | 92 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { |
| 85 registry->RegisterBooleanPref(prefs::kOobeComplete, false); | 93 registry->RegisterBooleanPref(prefs::kOobeComplete, false); |
| 86 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); | 94 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); |
| 87 registry->RegisterBooleanPref(prefs::kOobeMdMode, false); | 95 registry->RegisterBooleanPref(prefs::kOobeMdMode, false); |
| 88 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); | 96 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); |
| 89 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); | 97 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); |
| 90 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); | 98 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); |
| 91 registry->RegisterBooleanPref(prefs::kIsBootstrappingSlave, false); | 99 registry->RegisterBooleanPref(prefs::kIsBootstrappingSlave, false); |
| 92 registry->RegisterBooleanPref(prefs::kOobeControllerDetected, false); | 100 registry->RegisterBooleanPref(prefs::kOobeControllerDetected, false); |
|
xiyuan
2017/05/09 22:03:52
You need to register kTimeOfLastUpdateCheckWithout
kumarniranjan
2017/05/09 22:49:47
Done.
| |
| 93 } | 101 } |
| 94 | 102 |
| 95 // static | 103 // static |
| 96 bool StartupUtils::IsEulaAccepted() { | 104 bool StartupUtils::IsEulaAccepted() { |
| 97 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); | 105 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); |
| 98 } | 106 } |
| 99 | 107 |
| 100 // static | 108 // static |
| 101 bool StartupUtils::IsOobeCompleted() { | 109 bool StartupUtils::IsOobeCompleted() { |
| 102 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete); | 110 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 } | 199 } |
| 192 | 200 |
| 193 // static | 201 // static |
| 194 void StartupUtils::SetInitialLocale(const std::string& locale) { | 202 void StartupUtils::SetInitialLocale(const std::string& locale) { |
| 195 if (l10n_util::IsValidLocaleSyntax(locale)) | 203 if (l10n_util::IsValidLocaleSyntax(locale)) |
| 196 SaveStringPreferenceForced(prefs::kInitialLocale, locale); | 204 SaveStringPreferenceForced(prefs::kInitialLocale, locale); |
| 197 else | 205 else |
| 198 NOTREACHED(); | 206 NOTREACHED(); |
| 199 } | 207 } |
| 200 | 208 |
| 209 // static | |
| 210 void StartupUtils::SaveTimeOfLastUpdateCheckWithoutUpdate(base::Time time) { | |
| 211 SaveInt64PreferenceForced(prefs::kTimeOfLastUpdateCheckWithoutUpdate, | |
|
xiyuan
2017/05/09 22:03:52
Where is kTimeOfLastUpdateCheckWithoutUpdate defin
kumarniranjan
2017/05/09 22:49:47
Done.
| |
| 212 time->ToInternalvalue()); | |
| 213 } | |
| 214 | |
| 215 // static | |
| 216 base::Time StartupUtils::GetTimeOfLastUpdateCheckWithoutUpdate() { | |
| 217 return base::Time::FromInternalValue( | |
| 218 g_browser_process->local_state()->GetInt64( | |
| 219 prefs::kTimeOfLastUpdateCheckWithoutUpdate)); | |
| 220 } | |
| 221 | |
| 201 } // namespace chromeos | 222 } // namespace chromeos |
| OLD | NEW |