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

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

Issue 1308833004: Show Goodies page to new Chromebook users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer comments: Round 4 Created 5 years, 3 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
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 "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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Forcing the second pref will force this one as well. Even if this one 80 // Forcing the second pref will force this one as well. Even if this one
81 // doesn't end up synced it is only going to eat up a couple of bytes with no 81 // doesn't end up synced it is only going to eat up a couple of bytes with no
82 // side-effects. 82 // side-effects.
83 g_browser_process->local_state()->ClearPref(prefs::kOobeScreenPending); 83 g_browser_process->local_state()->ClearPref(prefs::kOobeScreenPending);
84 SaveBoolPreferenceForced(prefs::kOobeComplete, true); 84 SaveBoolPreferenceForced(prefs::kOobeComplete, true);
85 85
86 // Successful enrollment implies that recovery is not required. 86 // Successful enrollment implies that recovery is not required.
87 SaveBoolPreferenceForced(prefs::kEnrollmentRecoveryRequired, false); 87 SaveBoolPreferenceForced(prefs::kEnrollmentRecoveryRequired, false);
88 } 88 }
89 89
90 // static
90 void StartupUtils::SaveOobePendingScreen(const std::string& screen) { 91 void StartupUtils::SaveOobePendingScreen(const std::string& screen) {
91 SaveStringPreferenceForced(prefs::kOobeScreenPending, screen); 92 SaveStringPreferenceForced(prefs::kOobeScreenPending, screen);
92 } 93 }
93 94
94 // Returns the path to flag file indicating that both parts of OOBE were 95 // Returns the path to flag file indicating that both parts of OOBE were
95 // completed. 96 // completed.
96 // On chrome device, returns /home/chronos/.oobe_completed. 97 // On chrome device, returns /home/chronos/.oobe_completed.
97 // On Linux desktop, returns {DIR_USER_DATA}/.oobe_completed. 98 // On Linux desktop, returns {DIR_USER_DATA}/.oobe_completed.
98 static base::FilePath GetOobeCompleteFlagPath() { 99 // static
100 base::FilePath StartupUtils::GetOobeCompleteFlagPath() {
99 // The constant is defined here so it won't be referenced directly. 101 // The constant is defined here so it won't be referenced directly.
100 const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed"; 102 const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed";
101 103
102 if (base::SysInfo::IsRunningOnChromeOS()) { 104 if (base::SysInfo::IsRunningOnChromeOS()) {
103 return base::FilePath(kOobeCompleteFlagFilePath); 105 return base::FilePath(kOobeCompleteFlagFilePath);
104 } else { 106 } else {
105 base::FilePath user_data_dir; 107 base::FilePath user_data_dir;
106 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 108 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
107 return user_data_dir.AppendASCII(".oobe_completed"); 109 return user_data_dir.AppendASCII(".oobe_completed");
108 } 110 }
109 } 111 }
110 112
111 static void CreateOobeCompleteFlagFile() { 113 static void CreateOobeCompleteFlagFile() {
112 // Create flag file for boot-time init scripts. 114 // Create flag file for boot-time init scripts.
113 base::FilePath oobe_complete_path = GetOobeCompleteFlagPath(); 115 const base::FilePath oobe_complete_path =
116 StartupUtils::GetOobeCompleteFlagPath();
114 if (!base::PathExists(oobe_complete_path)) { 117 if (!base::PathExists(oobe_complete_path)) {
115 FILE* oobe_flag_file = base::OpenFile(oobe_complete_path, "w+b"); 118 FILE* oobe_flag_file = base::OpenFile(oobe_complete_path, "w+b");
116 if (oobe_flag_file == NULL) 119 if (oobe_flag_file == NULL)
117 DLOG(WARNING) << oobe_complete_path.value() << " doesn't exist."; 120 DLOG(WARNING) << oobe_complete_path.value() << " doesn't exist.";
118 else 121 else
119 base::CloseFile(oobe_flag_file); 122 base::CloseFile(oobe_flag_file);
120 } 123 }
121 } 124 }
122 125
123 // static 126 // static
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 185
183 // static 186 // static
184 void StartupUtils::SetInitialLocale(const std::string& locale) { 187 void StartupUtils::SetInitialLocale(const std::string& locale) {
185 if (l10n_util::IsValidLocaleSyntax(locale)) 188 if (l10n_util::IsValidLocaleSyntax(locale))
186 SaveStringPreferenceForced(prefs::kInitialLocale, locale); 189 SaveStringPreferenceForced(prefs::kInitialLocale, locale);
187 else 190 else
188 NOTREACHED(); 191 NOTREACHED();
189 } 192 }
190 193
191 } // namespace chromeos 194 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698