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 CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // If a user of one of the ExternalCache's extensions detects that | 114 // If a user of one of the ExternalCache's extensions detects that |
115 // the extension is damaged then this method can be used to remove it from | 115 // the extension is damaged then this method can be used to remove it from |
116 // the cache and retry to download it after a restart. | 116 // the cache and retry to download it after a restart. |
117 void OnDamagedFileDetected(const base::FilePath& path); | 117 void OnDamagedFileDetected(const base::FilePath& path); |
118 | 118 |
119 // Removes extensions listed in |ids| from external cache, corresponding crx | 119 // Removes extensions listed in |ids| from external cache, corresponding crx |
120 // files will be removed from disk too. | 120 // files will be removed from disk too. |
121 void RemoveExtensions(const std::vector<std::string>& ids); | 121 void RemoveExtensions(const std::vector<std::string>& ids); |
122 | 122 |
| 123 // If extension with |id| exists in the cache, returns |true|, |file_path| and |
| 124 // |version| for the extension. Extension will be marked as used with current |
| 125 // timestamp. |
| 126 bool GetExtension(const std::string& id, |
| 127 base::FilePath* file_path, |
| 128 std::string* version); |
| 129 |
123 private: | 130 private: |
124 // Notifies the that the cache has been updated, providing | 131 // Notifies the that the cache has been updated, providing |
125 // extensions loader with an updated list of extensions. | 132 // extensions loader with an updated list of extensions. |
126 void UpdateExtensionLoader(); | 133 void UpdateExtensionLoader(); |
127 | 134 |
128 // Checks the cache contents and initiate download if needed. | 135 // Checks the cache contents and initiate download if needed. |
129 void CheckCache(); | 136 void CheckCache(); |
130 | 137 |
131 // Invoked on the UI thread when a new entry has been installed in the cache. | 138 // Invoked on the UI thread when a new entry has been installed in the cache. |
132 void OnPutExtension(const std::string& id, | 139 void OnPutExtension(const std::string& id, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 172 |
166 // Weak factory for callbacks. | 173 // Weak factory for callbacks. |
167 base::WeakPtrFactory<ExternalCache> weak_ptr_factory_; | 174 base::WeakPtrFactory<ExternalCache> weak_ptr_factory_; |
168 | 175 |
169 DISALLOW_COPY_AND_ASSIGN(ExternalCache); | 176 DISALLOW_COPY_AND_ASSIGN(ExternalCache); |
170 }; | 177 }; |
171 | 178 |
172 } // namespace chromeos | 179 } // namespace chromeos |
173 | 180 |
174 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ | 181 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ |
OLD | NEW |