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

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

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (!file_util::ReadFileToString(master_prefs_path, &json_data)) 59 if (!file_util::ReadFileToString(master_prefs_path, &json_data))
60 return NULL; 60 return NULL;
61 61
62 JSONStringValueSerializer json(json_data); 62 JSONStringValueSerializer json(json_data);
63 std::string error; 63 std::string error;
64 scoped_ptr<Value> root(json.Deserialize(NULL, &error)); 64 scoped_ptr<Value> root(json.Deserialize(NULL, &error));
65 if (!root.get()) { 65 if (!root.get()) {
66 LOG(WARNING) << "Failed to parse master prefs file: " << error; 66 LOG(WARNING) << "Failed to parse master prefs file: " << error;
67 return NULL; 67 return NULL;
68 } 68 }
69 if (!root->IsType(Value::TYPE_DICTIONARY)) { 69 if (!root->IsDictionary()) {
70 LOG(WARNING) << "Failed to parse master prefs file: " 70 LOG(WARNING) << "Failed to parse master prefs file: "
71 << "Root item must be a dictionary."; 71 << "Root item must be a dictionary.";
72 return NULL; 72 return NULL;
73 } 73 }
74 return static_cast<DictionaryValue*>(root.release()); 74 return static_cast<DictionaryValue*>(root.release());
75 } 75 }
76 76
77 } // namespace 77 } // namespace
78 78
79 namespace installer { 79 namespace installer {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const { 270 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const {
271 return master_dictionary_->GetDictionary( 271 return master_dictionary_->GetDictionary(
272 master_preferences::kExtensionsBlock, extensions); 272 master_preferences::kExtensionsBlock, extensions);
273 } 273 }
274 274
275 // static 275 // static
276 const MasterPreferences& MasterPreferences::ForCurrentProcess() { 276 const MasterPreferences& MasterPreferences::ForCurrentProcess() {
277 return g_master_preferences.Get(); 277 return g_master_preferences.Get();
278 } 278 }
279 } // installer_util 279 } // installer_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698