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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 } | 88 } |
89 | 89 |
90 void StartupUtils::SaveOobePendingScreen(const std::string& screen) { | 90 void StartupUtils::SaveOobePendingScreen(const std::string& screen) { |
91 SaveStringPreferenceForced(prefs::kOobeScreenPending, screen); | 91 SaveStringPreferenceForced(prefs::kOobeScreenPending, screen); |
92 } | 92 } |
93 | 93 |
94 // Returns the path to flag file indicating that both parts of OOBE were | 94 // Returns the path to flag file indicating that both parts of OOBE were |
95 // completed. | 95 // completed. |
96 // On chrome device, returns /home/chronos/.oobe_completed. | 96 // On chrome device, returns /home/chronos/.oobe_completed. |
97 // On Linux desktop, returns {DIR_USER_DATA}/.oobe_completed. | 97 // On Linux desktop, returns {DIR_USER_DATA}/.oobe_completed. |
98 static base::FilePath GetOobeCompleteFlagPath() { | 98 base::FilePath StartupUtils::GetOobeCompleteFlagPath() { |
99 // The constant is defined here so it won't be referenced directly. | 99 // The constant is defined here so it won't be referenced directly. |
100 const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed"; | 100 const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed"; |
101 | 101 |
102 if (base::SysInfo::IsRunningOnChromeOS()) { | 102 if (base::SysInfo::IsRunningOnChromeOS()) { |
103 return base::FilePath(kOobeCompleteFlagFilePath); | 103 return base::FilePath(kOobeCompleteFlagFilePath); |
104 } else { | 104 } else { |
105 base::FilePath user_data_dir; | 105 base::FilePath user_data_dir; |
106 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 106 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
107 return user_data_dir.AppendASCII(".oobe_completed"); | 107 return user_data_dir.AppendASCII(".oobe_completed"); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 static void CreateOobeCompleteFlagFile() { | 111 static void CreateOobeCompleteFlagFile() { |
112 // Create flag file for boot-time init scripts. | 112 // Create flag file for boot-time init scripts. |
113 base::FilePath oobe_complete_path = GetOobeCompleteFlagPath(); | 113 base::FilePath oobe_complete_path = StartupUtils::GetOobeCompleteFlagPath(); |
achuithb
2015/09/15 18:20:54
const
Greg Levin
2015/09/15 21:44:49
Done.
| |
114 if (!base::PathExists(oobe_complete_path)) { | 114 if (!base::PathExists(oobe_complete_path)) { |
115 FILE* oobe_flag_file = base::OpenFile(oobe_complete_path, "w+b"); | 115 FILE* oobe_flag_file = base::OpenFile(oobe_complete_path, "w+b"); |
116 if (oobe_flag_file == NULL) | 116 if (oobe_flag_file == NULL) |
117 DLOG(WARNING) << oobe_complete_path.value() << " doesn't exist."; | 117 DLOG(WARNING) << oobe_complete_path.value() << " doesn't exist."; |
118 else | 118 else |
119 base::CloseFile(oobe_flag_file); | 119 base::CloseFile(oobe_flag_file); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 // static | 123 // static |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 | 182 |
183 // static | 183 // static |
184 void StartupUtils::SetInitialLocale(const std::string& locale) { | 184 void StartupUtils::SetInitialLocale(const std::string& locale) { |
185 if (l10n_util::IsValidLocaleSyntax(locale)) | 185 if (l10n_util::IsValidLocaleSyntax(locale)) |
186 SaveStringPreferenceForced(prefs::kInitialLocale, locale); | 186 SaveStringPreferenceForced(prefs::kInitialLocale, locale); |
187 else | 187 else |
188 NOTREACHED(); | 188 NOTREACHED(); |
189 } | 189 } |
190 | 190 |
191 } // namespace chromeos | 191 } // namespace chromeos |
OLD | NEW |