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/installer/util/master_preferences.h" | 5 #include "chrome/installer/util/master_preferences.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 env->GetVar(env_vars::kGoogleUpdateIsMachineEnvVar, &is_machine_var); | 156 env->GetVar(env_vars::kGoogleUpdateIsMachineEnvVar, &is_machine_var); |
157 if (is_machine_var == "1") { | 157 if (is_machine_var == "1") { |
158 VLOG(1) << "Taking system-level from environment."; | 158 VLOG(1) << "Taking system-level from environment."; |
159 name.assign(installer::master_preferences::kDistroDict); | 159 name.assign(installer::master_preferences::kDistroDict); |
160 name.append(".").append(installer::master_preferences::kSystemLevel); | 160 name.append(".").append(installer::master_preferences::kSystemLevel); |
161 master_dictionary_->SetBoolean(name, true); | 161 master_dictionary_->SetBoolean(name, true); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 // Strip multi-install from the dictionary, if present. This ensures that any | 165 // Strip multi-install from the dictionary, if present. This ensures that any |
166 // code that probes the dictionary directly to check for multi-install (rather | 166 // code that probes the dictionary directly to check for multi-install |
167 // than calling is_multi_install()) receives false. The updated dictionary is | 167 // receives false. The updated dictionary is not written back to disk. |
168 // not written back to disk. | 168 master_dictionary_->Remove( |
169 master_dictionary_->Remove(std::string(master_preferences::kDistroDict) + | 169 std::string(master_preferences::kDistroDict) + ".multi_install", nullptr); |
170 '.' + master_preferences::kMultiInstall, | |
171 nullptr); | |
172 | 170 |
173 // Cache a pointer to the distribution dictionary. Ignore errors if any. | 171 // Cache a pointer to the distribution dictionary. Ignore errors if any. |
174 master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict, | 172 master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict, |
175 &distribution_); | 173 &distribution_); |
176 #endif | 174 #endif |
177 } | 175 } |
178 | 176 |
179 void MasterPreferences::InitializeFromFilePath( | 177 void MasterPreferences::InitializeFromFilePath( |
180 const base::FilePath& prefs_path) { | 178 const base::FilePath& prefs_path) { |
181 std::string json_data; | 179 std::string json_data; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 274 } |
277 return result; | 275 return result; |
278 } | 276 } |
279 | 277 |
280 // static | 278 // static |
281 const MasterPreferences& MasterPreferences::ForCurrentProcess() { | 279 const MasterPreferences& MasterPreferences::ForCurrentProcess() { |
282 return g_master_preferences.Get(); | 280 return g_master_preferences.Get(); |
283 } | 281 } |
284 | 282 |
285 } // namespace installer | 283 } // namespace installer |
OLD | NEW |