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

Side by Side Diff: chrome/service/service_process_prefs.cc

Issue 5646003: Sanitize PrefStore interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefService mock construction in PrefServiceTest to include command line store. 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/service/service_process_prefs.h ('k') | chrome/test/reliability/page_load_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/service/service_process_prefs.h"
6
7 #include "base/values.h"
8
9 ServiceProcessPrefs::ServiceProcessPrefs(
10 const FilePath& pref_filename,
11 base::MessageLoopProxy* file_message_loop_proxy)
12 : prefs_(pref_filename, file_message_loop_proxy) {
13 }
14
15 void ServiceProcessPrefs::ReadPrefs() {
16 prefs_.ReadPrefs();
17 }
18
19 void ServiceProcessPrefs::WritePrefs() {
20 prefs_.WritePrefs();
21 }
22
23 void ServiceProcessPrefs::GetString(const std::string& key,
24 std::string* result) {
25 Value* value;
26 if (prefs_.GetValue(key, &value) == PersistentPrefStore::READ_OK)
27 value->GetAsString(result);
28 }
29
30 void ServiceProcessPrefs::SetString(const std::string& key,
31 const std::string& value) {
32 prefs_.SetValue(key, Value::CreateStringValue(value));
33 }
34
35 void ServiceProcessPrefs::GetBoolean(const std::string& key, bool* result) {
36 Value* value;
37 if (prefs_.GetValue(key, &value) == PersistentPrefStore::READ_OK)
38 value->GetAsBoolean(result);
39 }
40
41 void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) {
42 prefs_.SetValue(key, Value::CreateBooleanValue(value));
43 }
44
45 void ServiceProcessPrefs::GetDictionary(const std::string& key,
46 DictionaryValue** result) {
47 Value* value;
48 if (prefs_.GetValue(key, &value) != PersistentPrefStore::READ_OK ||
49 !value->IsType(Value::TYPE_DICTIONARY)) {
50 return;
51 }
52
53 *result = static_cast<DictionaryValue*>(value);
54 }
OLDNEW
« no previous file with comments | « chrome/service/service_process_prefs.h ('k') | chrome/test/reliability/page_load_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698