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

Side by Side Diff: services/url_response_disk_cache/url_response_disk_cache_impl.h

Issue 1088533003: Adding URLResponse Disk Cache to mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 7 months 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
OLDNEW
(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_IMPL_H_
6 #define SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_IMPL_H_
7
8 #include "base/files/file_path.h"
9 #include "base/macros.h"
10 #include "base/threading/sequenced_worker_pool.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h"
12 #include "mojo/services/url_response_disk_cache/public/interfaces/url_response_d isk_cache.mojom.h"
13
14 namespace mojo {
15
16 class URLResponseDiskCacheImpl : public URLResponseDiskCache {
17 public:
18 using FilePathPairCallback =
19 base::Callback<void(const base::FilePath&, const base::FilePath&)>;
20
21 URLResponseDiskCacheImpl(scoped_refptr<base::SequencedWorkerPool> worker_pool,
22 const std::string& remote_application_url,
23 InterfaceRequest<URLResponseDiskCache> request);
24 ~URLResponseDiskCacheImpl() override;
25
26 private:
27 // URLResponseDiskCache
28 void GetFile(mojo::URLResponsePtr response,
29 const GetFileCallback& callback) override;
30 void GetExtractedContent(
31 mojo::URLResponsePtr response,
32 const GetExtractedContentCallback& callback) override;
33
34 // As |GetFile|, but uses FilePath instead of mojo arrays.
35 void GetFileInternal(mojo::URLResponsePtr response,
36 const FilePathPairCallback& callback);
37
38 // Internal implementation of |GetExtractedContent|. The parameters are:
39 // |callback|: The callback to return values to the caller. It uses FilePath
40 // instead of mojo arrays.
41 // |cache_dir|: The cache dir to return to the consumer.
42 // |content|: The content of the body of the response.
43 // |dir|: The base directory under which all data for the response is stored.
44 void GetExtractedContentInternal(const FilePathPairCallback& callback,
45 const base::FilePath& cache_dir,
46 const base::FilePath& content,
47 const base::FilePath& dir);
48
49 scoped_refptr<base::SequencedWorkerPool> worker_pool_;
50 base::FilePath base_directory_;
51 StrongBinding<URLResponseDiskCache> binding_;
52
53 DISALLOW_COPY_AND_ASSIGN(URLResponseDiskCacheImpl);
54 };
55
56 } // namespace mojo
57
58 #endif // SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698