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

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

Issue 11232048: Adding XMPP ping functionality to CLoudPrint. XMPP ping and timeout is controlled thorugh Service S… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added missing files Created 8 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
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/service/service_process_prefs.h" 5 #include "chrome/service/service_process_prefs.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 8
9 ServiceProcessPrefs::ServiceProcessPrefs( 9 ServiceProcessPrefs::ServiceProcessPrefs(
10 const FilePath& pref_filename, 10 const FilePath& pref_filename,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 !value->GetAsBoolean(&result)) { 47 !value->GetAsBoolean(&result)) {
48 return default_value; 48 return default_value;
49 } 49 }
50 return result; 50 return result;
51 } 51 }
52 52
53 void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) { 53 void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) {
54 prefs_->SetValue(key, Value::CreateBooleanValue(value)); 54 prefs_->SetValue(key, Value::CreateBooleanValue(value));
55 } 55 }
56 56
57 int ServiceProcessPrefs::GetInt(const std::string& key,
58 int default_value) const {
59 const Value* value;
60 int result = default_value;
61 if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK ||
62 !value->GetAsInteger(&result)) {
63 return default_value;
64 }
65 return result;
66 }
67
68 void ServiceProcessPrefs::SetInt(const std::string& key, int value) {
69 prefs_->SetValue(key, Value::CreateIntegerValue(value));
70 }
71
57 const DictionaryValue* ServiceProcessPrefs::GetDictionary( 72 const DictionaryValue* ServiceProcessPrefs::GetDictionary(
58 const std::string& key) const { 73 const std::string& key) const {
59 const Value* value; 74 const Value* value;
60 if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK || 75 if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK ||
61 !value->IsType(Value::TYPE_DICTIONARY)) { 76 !value->IsType(Value::TYPE_DICTIONARY)) {
62 return NULL; 77 return NULL;
63 } 78 }
64 79
65 return static_cast<const DictionaryValue*>(value); 80 return static_cast<const DictionaryValue*>(value);
66 } 81 }
(...skipping 10 matching lines...) Expand all
77 } 92 }
78 93
79 void ServiceProcessPrefs::SetValue(const std::string& key, base::Value* value) { 94 void ServiceProcessPrefs::SetValue(const std::string& key, base::Value* value) {
80 prefs_->SetValue(key, value); 95 prefs_->SetValue(key, value);
81 } 96 }
82 97
83 void ServiceProcessPrefs::RemovePref(const std::string& key) { 98 void ServiceProcessPrefs::RemovePref(const std::string& key) {
84 prefs_->RemoveValue(key); 99 prefs_->RemoveValue(key);
85 } 100 }
86 101
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698