OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium 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 SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_DELEGATE_H_ |
| 6 #define SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_DELEGATE_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" |
| 10 #include "base/task_runner.h" |
| 11 |
| 12 namespace mojo { |
| 13 |
| 14 // This class allows to customized the behavior of the |URLResponseDiskCache| |
| 15 // implementation. |
| 16 class URLResponseDiskCacheDelegate { |
| 17 public: |
| 18 URLResponseDiskCacheDelegate() {} |
| 19 virtual ~URLResponseDiskCacheDelegate() {} |
| 20 |
| 21 // Allows to prefill the cache with content. This method will be called by the |
| 22 // cache when an item that has never been in the cache is requested. |
| 23 // |task_runner| is a task runner that can be used to do I/O. |url| is the url |
| 24 // of the entry. |target| is a path where the content must be copied to if it |
| 25 // exists. |callback| must be called with |true| if the delegate can retrieve |
| 26 // an initial content for |url| after having push the content to |target|, |
| 27 // otherwise, |callback| must be called with |false|. |callback| can be called |
| 28 // before this method returns. |
| 29 virtual void GetInitialPath(scoped_refptr<base::TaskRunner> task_runner, |
| 30 const std::string& url, |
| 31 const base::FilePath& target, |
| 32 const base::Callback<void(bool)>& callback) = 0; |
| 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(URLResponseDiskCacheDelegate); |
| 35 }; |
| 36 |
| 37 } // namespace mojo |
| 38 |
| 39 #endif // SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_DELEGATE_H_ |
OLD | NEW |