| OLD | NEW |
| 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 COMPONENTS_POLICY_CORE_COMMON_CLOUD_RESOURCE_CACHE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_RESOURCE_CACHE_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_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> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const std::set<std::string>& subkeys_to_keep); | 68 const std::set<std::string>& subkeys_to_keep); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // Points |path| at the cache directory for |key| and returns whether the | 71 // Points |path| at the cache directory for |key| and returns whether the |
| 72 // directory exists. If |allow_create| is |true|, the directory is created if | 72 // directory exists. If |allow_create| is |true|, the directory is created if |
| 73 // it did not exist yet. | 73 // it did not exist yet. |
| 74 bool VerifyKeyPath(const std::string& key, | 74 bool VerifyKeyPath(const std::string& key, |
| 75 bool allow_create, | 75 bool allow_create, |
| 76 base::FilePath* path); | 76 base::FilePath* path); |
| 77 | 77 |
| 78 // Points |path| at the file in which data for (key, subkey) should be stored | 78 // Points |subkey_path| at the file in which data for (key, subkey) should be |
| 79 // and returns whether the parent directory of this file exists. If | 79 // stored and returns whether the parent directory of this file exists. If |
| 80 // |allow_create_key| is |true|, the directory is created if it did not exist | 80 // |allow_create_key| is |true|, the directory is created if it did not exist |
| 81 // yet. This method does not check whether the file at |path| exists or not. | 81 // yet. This method does not check whether the file at |subkey_path| exists or |
| 82 // not. |
| 82 bool VerifyKeyPathAndGetSubkeyPath(const std::string& key, | 83 bool VerifyKeyPathAndGetSubkeyPath(const std::string& key, |
| 83 bool allow_create_key, | 84 bool allow_create_key, |
| 84 const std::string& subkey, | 85 const std::string& subkey, |
| 85 base::FilePath* subkey_path); | 86 base::FilePath* subkey_path); |
| 86 | 87 |
| 87 base::FilePath cache_dir_; | 88 base::FilePath cache_dir_; |
| 88 | 89 |
| 89 // Task runner that |this| runs on. | 90 // Task runner that |this| runs on. |
| 90 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 91 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 91 | 92 |
| 92 DISALLOW_COPY_AND_ASSIGN(ResourceCache); | 93 DISALLOW_COPY_AND_ASSIGN(ResourceCache); |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 } // namespace policy | 96 } // namespace policy |
| 96 | 97 |
| 97 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_RESOURCE_CACHE_H_ | 98 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_RESOURCE_CACHE_H_ |
| OLD | NEW |