| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 const base::FilePath& file_path, | 157 const base::FilePath& file_path, |
| 158 const std::string& version, | 158 const std::string& version, |
| 159 const PutExtensionCallback& callback); | 159 const PutExtensionCallback& callback); |
| 160 | 160 |
| 161 // Invoked on the UI thread when a new entry has been installed in the cache. | 161 // Invoked on the UI thread when a new entry has been installed in the cache. |
| 162 void OnCacheEntryInstalled(const std::string& id, | 162 void OnCacheEntryInstalled(const std::string& id, |
| 163 const CacheItemInfo& info, | 163 const CacheItemInfo& info, |
| 164 bool was_error, | 164 bool was_error, |
| 165 const PutExtensionCallback& callback); | 165 const PutExtensionCallback& callback); |
| 166 | 166 |
| 167 // Remove crx file at |file_path| in the cache. This method is invoked via | 167 // Remove cached crx files(all versions) under |cached_dir| for extension with |
| 168 // the |backend_task_runner_|. | 168 // |id|. This method is invoked via the |backend_task_runner_|. |
| 169 static void BackendRemoveCacheEntry(const base::FilePath& file_path); | 169 static void BackendRemoveCacheEntry(const base::FilePath& cache_dir, |
| 170 const std::string& id); |
| 170 | 171 |
| 171 // Compare two cache items returns true if first item is older. | 172 // Compare two cache items returns true if first item is older. |
| 172 static bool CompareCacheItemsAge(const CacheMap::iterator& lhs, | 173 static bool CompareCacheItemsAge(const CacheMap::iterator& lhs, |
| 173 const CacheMap::iterator& rhs); | 174 const CacheMap::iterator& rhs); |
| 174 | 175 |
| 175 // Calculate which files need to be deleted and schedule files deletion. | 176 // Calculate which files need to be deleted and schedule files deletion. |
| 176 void CleanUp(); | 177 void CleanUp(); |
| 177 | 178 |
| 178 // Path to the directory where the extension cache is stored. | 179 // Path to the directory where the extension cache is stored. |
| 179 base::FilePath cache_dir_; | 180 base::FilePath cache_dir_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 199 | 200 |
| 200 // Delay between polling cache status. | 201 // Delay between polling cache status. |
| 201 base::TimeDelta cache_status_polling_delay_; | 202 base::TimeDelta cache_status_polling_delay_; |
| 202 | 203 |
| 203 DISALLOW_COPY_AND_ASSIGN(LocalExtensionCache); | 204 DISALLOW_COPY_AND_ASSIGN(LocalExtensionCache); |
| 204 }; | 205 }; |
| 205 | 206 |
| 206 } // namespace extensions | 207 } // namespace extensions |
| 207 | 208 |
| 208 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ | 209 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ |
| OLD | NEW |