| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 bool MasterPreferences::GetExtensionsBlock( | 288 bool MasterPreferences::GetExtensionsBlock( |
| 289 base::DictionaryValue** extensions) const { | 289 base::DictionaryValue** extensions) const { |
| 290 return master_dictionary_->GetDictionary( | 290 return master_dictionary_->GetDictionary( |
| 291 master_preferences::kExtensionsBlock, extensions); | 291 master_preferences::kExtensionsBlock, extensions); |
| 292 } | 292 } |
| 293 | 293 |
| 294 std::string MasterPreferences::GetCompressedVariationsSeed() const { | 294 std::string MasterPreferences::GetCompressedVariationsSeed() const { |
| 295 return ExtractPrefString(variations::prefs::kVariationsCompressedSeed); | 295 return ExtractPrefString(variations::prefs::kVariationsCompressedSeed); |
| 296 } | 296 } |
| 297 | 297 |
| 298 std::string MasterPreferences::GetVariationsSeed() const { | |
| 299 return ExtractPrefString(variations::prefs::kVariationsSeed); | |
| 300 } | |
| 301 | |
| 302 std::string MasterPreferences::GetVariationsSeedSignature() const { | 298 std::string MasterPreferences::GetVariationsSeedSignature() const { |
| 303 return ExtractPrefString(variations::prefs::kVariationsSeedSignature); | 299 return ExtractPrefString(variations::prefs::kVariationsSeedSignature); |
| 304 } | 300 } |
| 305 | 301 |
| 306 std::string MasterPreferences::ExtractPrefString( | 302 std::string MasterPreferences::ExtractPrefString( |
| 307 const std::string& name) const { | 303 const std::string& name) const { |
| 308 std::string result; | 304 std::string result; |
| 309 std::unique_ptr<base::Value> pref_value; | 305 std::unique_ptr<base::Value> pref_value; |
| 310 if (master_dictionary_->Remove(name, &pref_value)) { | 306 if (master_dictionary_->Remove(name, &pref_value)) { |
| 311 if (!pref_value->GetAsString(&result)) | 307 if (!pref_value->GetAsString(&result)) |
| 312 NOTREACHED(); | 308 NOTREACHED(); |
| 313 } | 309 } |
| 314 return result; | 310 return result; |
| 315 } | 311 } |
| 316 | 312 |
| 317 // static | 313 // static |
| 318 const MasterPreferences& MasterPreferences::ForCurrentProcess() { | 314 const MasterPreferences& MasterPreferences::ForCurrentProcess() { |
| 319 return g_master_preferences.Get(); | 315 return g_master_preferences.Get(); |
| 320 } | 316 } |
| 321 | 317 |
| 322 } // namespace installer | 318 } // namespace installer |
| OLD | NEW |