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

Unified Diff: chrome/service/service_process_prefs.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/service/service_process.cc ('k') | chrome/service/service_process_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/service_process_prefs.h
diff --git a/chrome/service/service_process_prefs.h b/chrome/service/service_process_prefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce86b03f2b3a45a2b8b117d6a38233c9dbee9b32
--- /dev/null
+++ b/chrome/service/service_process_prefs.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_SERVICE_SERVICE_PROCESS_PREFS_H_
+#define CHROME_SERVICE_SERVICE_PROCESS_PREFS_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/common/json_pref_store.h"
+
+// Manages persistent preferences for the service process. This is basically a
+// thin wrapper around JsonPrefStore for more comfortable use.
+class ServiceProcessPrefs {
+ public:
+ // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which
+ // file I/O can be done.
+ ServiceProcessPrefs(const FilePath& pref_filename,
+ base::MessageLoopProxy* file_message_loop_proxy);
+
+ // Read preferences from the backing file.
+ void ReadPrefs();
+
+ // Write the data to the backing file.
+ void WritePrefs();
+
+ // Get a string preference for |key| and store it in |result|.
+ void GetString(const std::string& key, std::string* result);
+
+ // Set a string |value| for |key|.
+ void SetString(const std::string& key, const std::string& value);
+
+ // Get a boolean preference for |key| and store it in |result|.
+ void GetBoolean(const std::string& key, bool* result);
+
+ // Set a boolean |value| for |key|.
+ void SetBoolean(const std::string& key, bool value);
+
+ // Get a dictionary preference for |key| and store it in |result|.
+ void GetDictionary(const std::string& key, DictionaryValue** result);
+
+ private:
+ JsonPrefStore prefs_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceProcessPrefs);
+};
+
+#endif // CHROME_SERVICE_SERVICE_PROCESS_PREFS_H_
« no previous file with comments | « chrome/service/service_process.cc ('k') | chrome/service/service_process_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698