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

Side by Side Diff: components/policy/core/common/cloud/resource_cache.h

Issue 109743002: Move policy code into components/policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar fixes Created 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_POLICY_CLOUD_RESOURCE_CACHE_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_RESOURCE_CACHE_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_RESOURCE_CACHE_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_RESOURCE_CACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "components/policy/policy_export.h"
16 17
17 namespace base { 18 namespace base {
18 class SequencedTaskRunner; 19 class SequencedTaskRunner;
19 } 20 }
20 21
21 namespace policy { 22 namespace policy {
22 23
23 // Manages storage of data at a given path. The data is keyed by a key and 24 // Manages storage of data at a given path. The data is keyed by a key and
24 // a subkey, and can be queried by (key, subkey) or (key) lookups. 25 // a subkey, and can be queried by (key, subkey) or (key) lookups.
25 // The contents of the cache have to be manually cleared using Delete() or 26 // The contents of the cache have to be manually cleared using Delete() or
26 // Purge*(). 27 // Purge*().
27 // The class can be instantiated on any thread but from then on, it must be 28 // The class can be instantiated on any thread but from then on, it must be
28 // accessed via the |task_runner| only. The |task_runner| must support file I/O. 29 // accessed via the |task_runner| only. The |task_runner| must support file I/O.
29 class ResourceCache { 30 class POLICY_EXPORT ResourceCache {
30 public: 31 public:
31 explicit ResourceCache(const base::FilePath& cache_path, 32 explicit ResourceCache(const base::FilePath& cache_path,
32 scoped_refptr<base::SequencedTaskRunner> task_runner); 33 scoped_refptr<base::SequencedTaskRunner> task_runner);
33 virtual ~ResourceCache(); 34 virtual ~ResourceCache();
34 35
35 // Stores |data| under (key, subkey). Returns true if the store suceeded, and 36 // Stores |data| under (key, subkey). Returns true if the store suceeded, and
36 // false otherwise. 37 // false otherwise.
37 bool Store(const std::string& key, 38 bool Store(const std::string& key,
38 const std::string& subkey, 39 const std::string& subkey,
39 const std::string& data); 40 const std::string& data);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 base::FilePath cache_dir_; 87 base::FilePath cache_dir_;
87 88
88 // Task runner that |this| runs on. 89 // Task runner that |this| runs on.
89 scoped_refptr<base::SequencedTaskRunner> task_runner_; 90 scoped_refptr<base::SequencedTaskRunner> task_runner_;
90 91
91 DISALLOW_COPY_AND_ASSIGN(ResourceCache); 92 DISALLOW_COPY_AND_ASSIGN(ResourceCache);
92 }; 93 };
93 94
94 } // namespace policy 95 } // namespace policy
95 96
96 #endif // CHROME_BROWSER_POLICY_CLOUD_RESOURCE_CACHE_H_ 97 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_RESOURCE_CACHE_H_
OLDNEW
« no previous file with comments | « components/policy/core/common/cloud/rate_limiter_unittest.cc ('k') | components/policy/core/common/cloud/resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698