Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: chrome/browser/chromeos/login/startup_utils.cc

Issue 2952083002: Remove unnecessary logic from UpdateScreen (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/login/startup_utils.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 23 matching lines...) Expand all
34 prefs->CommitPendingWrite(); 34 prefs->CommitPendingWrite();
35 } 35 }
36 36
37 // Saves integer "Local State" preference and forces its persistence to disk. 37 // Saves integer "Local State" preference and forces its persistence to disk.
38 void SaveIntegerPreferenceForced(const char* pref_name, int value) { 38 void SaveIntegerPreferenceForced(const char* pref_name, int value) {
39 PrefService* prefs = g_browser_process->local_state(); 39 PrefService* prefs = g_browser_process->local_state();
40 prefs->SetInteger(pref_name, value); 40 prefs->SetInteger(pref_name, value);
41 prefs->CommitPendingWrite(); 41 prefs->CommitPendingWrite();
42 } 42 }
43 43
44 // Saves 64 bit signed integer "Local State" preference and forces its
45 // persistence to disk.
46 void SaveInt64PreferenceForced(const char* pref_name, int64_t value) {
47 PrefService* prefs = g_browser_process->local_state();
48 prefs->SetInt64(pref_name, value);
49 prefs->CommitPendingWrite();
50 }
51
52 // Saves string "Local State" preference and forces its persistence to disk. 44 // Saves string "Local State" preference and forces its persistence to disk.
53 void SaveStringPreferenceForced(const char* pref_name, 45 void SaveStringPreferenceForced(const char* pref_name,
54 const std::string& value) { 46 const std::string& value) {
55 PrefService* prefs = g_browser_process->local_state(); 47 PrefService* prefs = g_browser_process->local_state();
56 prefs->SetString(pref_name, value); 48 prefs->SetString(pref_name, value);
57 prefs->CommitPendingWrite(); 49 prefs->CommitPendingWrite();
58 } 50 }
59 51
60 // Returns the path to flag file indicating that both parts of OOBE were 52 // Returns the path to flag file indicating that both parts of OOBE were
61 // completed. 53 // completed.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // static 85 // static
94 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { 86 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) {
95 registry->RegisterBooleanPref(prefs::kOobeComplete, false); 87 registry->RegisterBooleanPref(prefs::kOobeComplete, false);
96 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); 88 registry->RegisterStringPref(prefs::kOobeScreenPending, "");
97 registry->RegisterBooleanPref(prefs::kOobeMdMode, false); 89 registry->RegisterBooleanPref(prefs::kOobeMdMode, false);
98 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); 90 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1);
99 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); 91 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false);
100 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); 92 registry->RegisterStringPref(prefs::kInitialLocale, "en-US");
101 registry->RegisterBooleanPref(prefs::kIsBootstrappingSlave, false); 93 registry->RegisterBooleanPref(prefs::kIsBootstrappingSlave, false);
102 registry->RegisterBooleanPref(prefs::kOobeControllerDetected, false); 94 registry->RegisterBooleanPref(prefs::kOobeControllerDetected, false);
103 registry->RegisterInt64Pref(prefs::kOobeTimeOfLastUpdateCheckWithoutUpdate,
104 0);
105 } 95 }
106 96
107 // static 97 // static
108 bool StartupUtils::IsEulaAccepted() { 98 bool StartupUtils::IsEulaAccepted() {
109 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); 99 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted);
110 } 100 }
111 101
112 // static 102 // static
113 bool StartupUtils::IsOobeCompleted() { 103 bool StartupUtils::IsOobeCompleted() {
114 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete); 104 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 189 }
200 190
201 // static 191 // static
202 void StartupUtils::SetInitialLocale(const std::string& locale) { 192 void StartupUtils::SetInitialLocale(const std::string& locale) {
203 if (l10n_util::IsValidLocaleSyntax(locale)) 193 if (l10n_util::IsValidLocaleSyntax(locale))
204 SaveStringPreferenceForced(prefs::kInitialLocale, locale); 194 SaveStringPreferenceForced(prefs::kInitialLocale, locale);
205 else 195 else
206 NOTREACHED(); 196 NOTREACHED();
207 } 197 }
208 198
209 // static
210 void StartupUtils::SaveTimeOfLastUpdateCheckWithoutUpdate(base::Time time) {
211 SaveInt64PreferenceForced(prefs::kOobeTimeOfLastUpdateCheckWithoutUpdate,
212 time.ToInternalValue());
213 }
214
215 // static
216 void StartupUtils::ClearTimeOfLastUpdateCheckWithoutUpdate() {
217 PrefService* prefs = g_browser_process->local_state();
218 prefs->ClearPref(prefs::kOobeTimeOfLastUpdateCheckWithoutUpdate);
219 prefs->CommitPendingWrite();
220 }
221
222 // static
223 base::Time StartupUtils::GetTimeOfLastUpdateCheckWithoutUpdate() {
224 return base::Time::FromInternalValue(
225 g_browser_process->local_state()->GetInt64(
226 prefs::kOobeTimeOfLastUpdateCheckWithoutUpdate));
227 }
228
229 } // namespace chromeos 199 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/startup_utils.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698