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

Side by Side Diff: chrome/installer/util/master_preferences.cc

Issue 16270: Change the signature of JSONReader::Read() and related methods to be more (Closed)
Patch Set: fixens Created 11 years, 11 months 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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 5
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/common/json_value_serializer.h" 8 #include "chrome/common/json_value_serializer.h"
9 #include "chrome/installer/util/master_preferences.h" 9 #include "chrome/installer/util/master_preferences.h"
10 10
11 namespace { 11 namespace {
12 12
13 DictionaryValue* ReadJSONPrefs(const std::string& data) { 13 DictionaryValue* ReadJSONPrefs(const std::string& data) {
14 JSONStringValueSerializer json(data); 14 JSONStringValueSerializer json(data);
15 Value* root; 15 scoped_ptr<Value> root(json.Deserialize(NULL));
16 if (!json.Deserialize(&root, NULL)) 16 if (!root.get())
17 return NULL; 17 return NULL;
18 if (!root->IsType(Value::TYPE_DICTIONARY)) { 18 if (!root->IsType(Value::TYPE_DICTIONARY))
19 delete root;
20 return NULL; 19 return NULL;
21 } 20
22 return static_cast<DictionaryValue*>(root); 21 return static_cast<DictionaryValue*>(root.release());
23 } 22 }
24 23
25 bool GetBooleanPref(const DictionaryValue* prefs, const std::wstring& name) { 24 bool GetBooleanPref(const DictionaryValue* prefs, const std::wstring& name) {
26 bool value = false; 25 bool value = false;
27 prefs->GetBoolean(name, &value); 26 prefs->GetBoolean(name, &value);
28 return value; 27 return value;
29 } 28 }
30 29
31 } // namespace 30 } // namespace
32 31
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (GetBooleanPref(json_root.get(), kSystemLevel)) 95 if (GetBooleanPref(json_root.get(), kSystemLevel))
97 parse_result |= MASTER_PROFILE_SYSTEM_LEVEL; 96 parse_result |= MASTER_PROFILE_SYSTEM_LEVEL;
98 97
99 if (GetBooleanPref(json_root.get(), kVerboseLogging)) 98 if (GetBooleanPref(json_root.get(), kVerboseLogging))
100 parse_result |= MASTER_PROFILE_VERBOSE_LOGGING; 99 parse_result |= MASTER_PROFILE_VERBOSE_LOGGING;
101 100
102 return parse_result; 101 return parse_result;
103 } 102 }
104 103
105 } // installer_util 104 } // installer_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698