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

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

Issue 5574006: Start deinlining non-empty virtual methods. (This will be automatically checked (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove virtual from VideoFrame::type() Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/json_pref_store.h ('k') | chrome/common/net/gaia/gaia_authenticator.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_pref_store.h" 5 #include "chrome/common/json_pref_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 12 matching lines...) Expand all
23 prefs_(new DictionaryValue()), 23 prefs_(new DictionaryValue()),
24 read_only_(false), 24 read_only_(false),
25 writer_(filename, file_message_loop_proxy) { 25 writer_(filename, file_message_loop_proxy) {
26 } 26 }
27 27
28 JsonPrefStore::~JsonPrefStore() { 28 JsonPrefStore::~JsonPrefStore() {
29 if (writer_.HasPendingWrite() && !read_only_) 29 if (writer_.HasPendingWrite() && !read_only_)
30 writer_.DoScheduledWrite(); 30 writer_.DoScheduledWrite();
31 } 31 }
32 32
33 bool JsonPrefStore::ReadOnly() const {
34 return read_only_;
35 }
36
37 DictionaryValue* JsonPrefStore::prefs() const {
38 return prefs_.get();
39 }
40
33 PrefStore::PrefReadError JsonPrefStore::ReadPrefs() { 41 PrefStore::PrefReadError JsonPrefStore::ReadPrefs() {
34 if (path_.empty()) { 42 if (path_.empty()) {
35 read_only_ = true; 43 read_only_ = true;
36 return PREF_READ_ERROR_FILE_NOT_SPECIFIED; 44 return PREF_READ_ERROR_FILE_NOT_SPECIFIED;
37 } 45 }
38 JSONFileValueSerializer serializer(path_); 46 JSONFileValueSerializer serializer(path_);
39 47
40 int error_code = 0; 48 int error_code = 0;
41 std::string error_msg; 49 std::string error_msg;
42 scoped_ptr<Value> value(serializer.Deserialize(&error_code, &error_msg)); 50 scoped_ptr<Value> value(serializer.Deserialize(&error_code, &error_msg));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 132 }
125 133
126 bool JsonPrefStore::SerializeData(std::string* output) { 134 bool JsonPrefStore::SerializeData(std::string* output) {
127 // TODO(tc): Do we want to prune webkit preferences that match the default 135 // TODO(tc): Do we want to prune webkit preferences that match the default
128 // value? 136 // value?
129 JSONStringValueSerializer serializer(output); 137 JSONStringValueSerializer serializer(output);
130 serializer.set_pretty_print(true); 138 serializer.set_pretty_print(true);
131 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); 139 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren());
132 return serializer.Serialize(*(copy.get())); 140 return serializer.Serialize(*(copy.get()));
133 } 141 }
OLDNEW
« no previous file with comments | « chrome/common/json_pref_store.h ('k') | chrome/common/net/gaia/gaia_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698