Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/profile_resetter/brandcoded_default_settings.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profile_resetter/brandcoded_default_settings.h" 5 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chrome/installer/util/master_preferences_constants.h" 10 #include "chrome/installer/util/master_preferences_constants.h"
11 #include "components/crx_file/id_util.h" 11 #include "components/crx_file/id_util.h"
12 #include "components/search_engines/search_engines_pref_names.h" 12 #include "components/search_engines/search_engines_pref_names.h"
13 13
14 BrandcodedDefaultSettings::BrandcodedDefaultSettings() { 14 BrandcodedDefaultSettings::BrandcodedDefaultSettings() {
15 } 15 }
16 16
17 BrandcodedDefaultSettings::BrandcodedDefaultSettings(const std::string& prefs) { 17 BrandcodedDefaultSettings::BrandcodedDefaultSettings(const std::string& prefs) {
18 if (!prefs.empty()) { 18 if (!prefs.empty()) {
19 JSONStringValueDeserializer json(prefs); 19 JSONStringValueDeserializer json(prefs);
20 std::string error; 20 std::string error;
21 std::unique_ptr<base::Value> root(json.Deserialize(NULL, &error)); 21 std::unique_ptr<base::Value> root(json.Deserialize(NULL, &error));
22 if (!root.get()) { 22 if (!root.get()) {
23 VLOG(1) << "Failed to parse brandcode prefs file: " << error; 23 VLOG(1) << "Failed to parse brandcode prefs file: " << error;
24 return; 24 return;
25 } 25 }
26 if (!root->IsType(base::Value::TYPE_DICTIONARY)) { 26 if (!root->IsType(base::Value::Type::DICTIONARY)) {
27 VLOG(1) << "Failed to parse brandcode prefs file: " 27 VLOG(1) << "Failed to parse brandcode prefs file: "
28 << "Root item must be a dictionary."; 28 << "Root item must be a dictionary.";
29 return; 29 return;
30 } 30 }
31 master_dictionary_.reset( 31 master_dictionary_.reset(
32 static_cast<base::DictionaryValue*>(root.release())); 32 static_cast<base::DictionaryValue*>(root.release()));
33 } 33 }
34 } 34 }
35 35
36 BrandcodedDefaultSettings::~BrandcodedDefaultSettings() { 36 BrandcodedDefaultSettings::~BrandcodedDefaultSettings() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 std::unique_ptr<base::ListValue> BrandcodedDefaultSettings::ExtractList( 94 std::unique_ptr<base::ListValue> BrandcodedDefaultSettings::ExtractList(
95 const char* pref_name) const { 95 const char* pref_name) const {
96 const base::ListValue* value = NULL; 96 const base::ListValue* value = NULL;
97 if (master_dictionary_ && 97 if (master_dictionary_ &&
98 master_dictionary_->GetList(pref_name, &value) && 98 master_dictionary_->GetList(pref_name, &value) &&
99 !value->empty()) { 99 !value->empty()) {
100 return std::unique_ptr<base::ListValue>(value->DeepCopy()); 100 return std::unique_ptr<base::ListValue>(value->DeepCopy());
101 } 101 }
102 return std::unique_ptr<base::ListValue>(); 102 return std::unique_ptr<base::ListValue>();
103 } 103 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/tracked/pref_hash_browsertest.cc ('k') | chrome/browser/profiles/guest_mode_policy_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698