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

Side by Side Diff: chrome/common/json_value_serializer.cc

Issue 241006: Reduce the number of unneeded dependencies.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/installer/installer.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/common/json_value_serializer.h" 5 #include "chrome/common/json_value_serializer.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json_reader.h" 8 #include "base/json_reader.h"
9 #include "base/json_writer.h" 9 #include "base/json_writer.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/common/logging_chrome.h"
12 11
13 JSONStringValueSerializer::~JSONStringValueSerializer() {} 12 JSONStringValueSerializer::~JSONStringValueSerializer() {}
14 13
15 bool JSONStringValueSerializer::Serialize(const Value& root) { 14 bool JSONStringValueSerializer::Serialize(const Value& root) {
16 if (!json_string_ || initialized_with_const_string_) 15 if (!json_string_ || initialized_with_const_string_)
17 return false; 16 return false;
18 17
19 JSONWriter::Write(&root, pretty_print_, json_string_); 18 JSONWriter::Write(&root, pretty_print_, json_string_);
20 19
21 return true; 20 return true;
(...skipping 27 matching lines...) Expand all
49 } 48 }
50 49
51 Value* JSONFileValueSerializer::Deserialize(std::string* error_message) { 50 Value* JSONFileValueSerializer::Deserialize(std::string* error_message) {
52 std::string json_string; 51 std::string json_string;
53 if (!file_util::ReadFileToString(json_file_path_, &json_string)) { 52 if (!file_util::ReadFileToString(json_file_path_, &json_string)) {
54 return NULL; 53 return NULL;
55 } 54 }
56 JSONStringValueSerializer serializer(json_string); 55 JSONStringValueSerializer serializer(json_string);
57 return serializer.Deserialize(error_message); 56 return serializer.Deserialize(error_message);
58 } 57 }
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/installer/installer.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698