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 "base/environment.h" | 7 #include "base/environment.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 master_dictionary_.reset(new DictionaryValue()); | 219 master_dictionary_.reset(new DictionaryValue()); |
220 data_is_valid = false; | 220 data_is_valid = false; |
221 } else { | 221 } else { |
222 // Cache a pointer to the distribution dictionary. | 222 // Cache a pointer to the distribution dictionary. |
223 master_dictionary_->GetDictionary( | 223 master_dictionary_->GetDictionary( |
224 installer::master_preferences::kDistroDict, &distribution_); | 224 installer::master_preferences::kDistroDict, &distribution_); |
225 } | 225 } |
226 | 226 |
227 InitializeProductFlags(); | 227 InitializeProductFlags(); |
228 EnforceLegacyPreferences(); | 228 EnforceLegacyPreferences(); |
229 EnforceShorcutPreferences(); | |
229 return data_is_valid; | 230 return data_is_valid; |
230 } | 231 } |
231 | 232 |
232 void MasterPreferences::InitializeProductFlags() { | 233 void MasterPreferences::InitializeProductFlags() { |
233 // Make sure we start out with the correct defaults. | 234 // Make sure we start out with the correct defaults. |
234 multi_install_ = false; | 235 multi_install_ = false; |
235 chrome_frame_ = false; | 236 chrome_frame_ = false; |
236 chrome_app_launcher_ = false; | 237 chrome_app_launcher_ = false; |
237 chrome_ = true; | 238 chrome_ = true; |
238 | 239 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 GetBool(installer::master_preferences::kCreateAllShortcuts, | 273 GetBool(installer::master_preferences::kCreateAllShortcuts, |
273 &create_all_shortcuts); | 274 &create_all_shortcuts); |
274 if (!create_all_shortcuts) { | 275 if (!create_all_shortcuts) { |
275 distribution_->SetBoolean( | 276 distribution_->SetBoolean( |
276 installer::master_preferences::kDoNotCreateDesktopShortcut, true); | 277 installer::master_preferences::kDoNotCreateDesktopShortcut, true); |
277 distribution_->SetBoolean( | 278 distribution_->SetBoolean( |
278 installer::master_preferences::kDoNotCreateQuickLaunchShortcut, true); | 279 installer::master_preferences::kDoNotCreateQuickLaunchShortcut, true); |
279 } | 280 } |
280 } | 281 } |
281 | 282 |
283 void MasterPreferences::EnforceShorcutPreferences() { | |
gab
2013/03/06 20:20:32
As mentioned in install.cc I would prefer that "do
Joao da Silva
2013/03/06 21:21:33
Agreed, done.
| |
284 bool do_not_create_any_shortcuts = false; | |
285 GetBool(installer::master_preferences::kDoNotCreateAnyShortcuts, | |
286 &do_not_create_any_shortcuts); | |
287 if (do_not_create_any_shortcuts) { | |
288 // do_not_create_any_shortcuts overrides all these preferences. | |
289 distribution_->SetBoolean( | |
290 installer::master_preferences::kDoNotCreateDesktopShortcut, true); | |
291 distribution_->SetBoolean( | |
292 installer::master_preferences::kDoNotCreateQuickLaunchShortcut, true); | |
293 distribution_->SetBoolean( | |
294 installer::master_preferences::kDoNotCreateTaskbarShortcut, true); | |
295 distribution_->SetBoolean( | |
296 installer::master_preferences::kCreateAllShortcuts, false); | |
297 } | |
298 } | |
299 | |
282 bool MasterPreferences::GetBool(const std::string& name, bool* value) const { | 300 bool MasterPreferences::GetBool(const std::string& name, bool* value) const { |
283 bool ret = false; | 301 bool ret = false; |
284 if (distribution_) | 302 if (distribution_) |
285 ret = distribution_->GetBoolean(name, value); | 303 ret = distribution_->GetBoolean(name, value); |
286 return ret; | 304 return ret; |
287 } | 305 } |
288 | 306 |
289 bool MasterPreferences::GetInt(const std::string& name, int* value) const { | 307 bool MasterPreferences::GetInt(const std::string& name, int* value) const { |
290 bool ret = false; | 308 bool ret = false; |
291 if (distribution_) | 309 if (distribution_) |
(...skipping 23 matching lines...) Expand all Loading... | |
315 master_dictionary_->GetString(prefs::kVariationsSeed, &variations_seed); | 333 master_dictionary_->GetString(prefs::kVariationsSeed, &variations_seed); |
316 return variations_seed; | 334 return variations_seed; |
317 } | 335 } |
318 | 336 |
319 // static | 337 // static |
320 const MasterPreferences& MasterPreferences::ForCurrentProcess() { | 338 const MasterPreferences& MasterPreferences::ForCurrentProcess() { |
321 return g_master_preferences.Get(); | 339 return g_master_preferences.Get(); |
322 } | 340 } |
323 | 341 |
324 } // namespace installer | 342 } // namespace installer |
OLD | NEW |