| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 94     : distribution_(NULL), | 94     : distribution_(NULL), | 
| 95       preferences_read_from_file_(false), | 95       preferences_read_from_file_(false), | 
| 96       chrome_(true), | 96       chrome_(true), | 
| 97       chrome_app_launcher_(false), | 97       chrome_app_launcher_(false), | 
| 98       chrome_frame_(false), | 98       chrome_frame_(false), | 
| 99       multi_install_(false) { | 99       multi_install_(false) { | 
| 100   std::string json_data; | 100   std::string json_data; | 
| 101   // Failure to read the file is ignored as |json_data| will be the empty string | 101   // Failure to read the file is ignored as |json_data| will be the empty string | 
| 102   // and the remainder of this MasterPreferences object should still be | 102   // and the remainder of this MasterPreferences object should still be | 
| 103   // initialized as best as possible. | 103   // initialized as best as possible. | 
| 104   if (file_util::PathExists(prefs_path) && | 104   if (base::PathExists(prefs_path) && | 
| 105       !file_util::ReadFileToString(prefs_path, &json_data)) { | 105       !file_util::ReadFileToString(prefs_path, &json_data)) { | 
| 106     LOG(ERROR) << "Failed to read preferences from " << prefs_path.value(); | 106     LOG(ERROR) << "Failed to read preferences from " << prefs_path.value(); | 
| 107   } | 107   } | 
| 108   if (InitializeFromString(json_data)) | 108   if (InitializeFromString(json_data)) | 
| 109     preferences_read_from_file_ = true; | 109     preferences_read_from_file_ = true; | 
| 110 } | 110 } | 
| 111 | 111 | 
| 112 MasterPreferences::MasterPreferences(const std::string& prefs) | 112 MasterPreferences::MasterPreferences(const std::string& prefs) | 
| 113     : distribution_(NULL), | 113     : distribution_(NULL), | 
| 114       preferences_read_from_file_(false), | 114       preferences_read_from_file_(false), | 
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 317   master_dictionary_->GetString(prefs::kVariationsSeed, &variations_seed); | 317   master_dictionary_->GetString(prefs::kVariationsSeed, &variations_seed); | 
| 318   return variations_seed; | 318   return variations_seed; | 
| 319 } | 319 } | 
| 320 | 320 | 
| 321 // static | 321 // static | 
| 322 const MasterPreferences& MasterPreferences::ForCurrentProcess() { | 322 const MasterPreferences& MasterPreferences::ForCurrentProcess() { | 
| 323   return g_master_preferences.Get(); | 323   return g_master_preferences.Get(); | 
| 324 } | 324 } | 
| 325 | 325 | 
| 326 }  // namespace installer | 326 }  // namespace installer | 
| OLD | NEW | 
|---|