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

Side by Side Diff: prefs.h

Issue 3014035: AU: Add support for persistent update engine preferences store. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: test directory creation Created 10 years, 5 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 | « SConstruct ('k') | prefs.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 OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_H__
7
8 #include "base/file_path.h"
9 #include "gtest/gtest_prod.h" // for FRIEND_TEST
10 #include "update_engine/prefs_interface.h"
11
12 namespace chromeos_update_engine {
13
14 // Implements a preference store by storing the value associated with
15 // a key in a separate file named after the key under a preference
16 // store directory.
17
18 class Prefs : public PrefsInterface {
19 public:
20 // Initializes the store by associating this object with |prefs_dir|
21 // as the preference store directory. Returns true on success, false
22 // otherwise.
23 bool Init(const FilePath& prefs_dir);
24
25 // PrefsInterface methods.
26 bool GetString(const std::string& key, std::string* value);
27 bool SetString(const std::string& key, const std::string& value);
28 bool GetInt64(const std::string& key, int64_t* value);
29 bool SetInt64(const std::string& key, const int64_t value);
30
31 private:
32 FRIEND_TEST(PrefsTest, GetFileNameForKey);
33 FRIEND_TEST(PrefsTest, GetFileNameForKeyBadCharacter);
34 FRIEND_TEST(PrefsTest, GetFileNameForKeyEmpty);
35
36 // Sets |filename| to the full path to the file containing the data
37 // associated with |key|. Returns true on success, false otherwise.
38 bool GetFileNameForKey(const std::string& key, FilePath* filename);
39
40 // Preference store directory.
41 FilePath prefs_dir_;
42 };
43
44 } // namespace chromeos_update_engine
45
46 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_H__
OLDNEW
« no previous file with comments | « SConstruct ('k') | prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698