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

Side by Side Diff: services/service_cache/service_cache_impl.h

Issue 1088533003: Adding URLResponse Disk Cache to mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: And now with full app tests and a bug fix. 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_SERVICE_CACHE_SERVICE_CACHE_IMPL_H_
6 #define SERVICES_SERVICE_CACHE_SERVICE_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/service_cache/public/interfaces/service_cache.mojom.h"
13
14 namespace mojo {
15 namespace service_cache {
16
17 class ServiceCacheImpl : public ServiceCache {
18 public:
19 using FilePathPairCallback =
20 base::Callback<void(const base::FilePath&, const base::FilePath&)>;
21
22 ServiceCacheImpl(scoped_refptr<base::SequencedWorkerPool> worker_pool,
23 const std::string& remote_application_url,
24 InterfaceRequest<ServiceCache> request);
25 ~ServiceCacheImpl() override;
26
27 private:
28 // ServiceCache
29 void GetFile(mojo::URLResponsePtr response,
30 const GetFileCallback& callback) override;
31 void GetExtractedContent(
32 mojo::URLResponsePtr response,
33 const GetExtractedContentCallback& callback) override;
34
35 void GetFileInternal(mojo::URLResponsePtr response,
36 const FilePathPairCallback& callback);
37
38 void GetExtractedContentInternal(const FilePathPairCallback& callback,
39 const base::FilePath& cache_dir,
40 const base::FilePath& content,
41 const base::FilePath& dir);
42
43 bool IsRequestAllowed(const mojo::URLResponsePtr& response);
44
45 scoped_refptr<base::SequencedWorkerPool> worker_pool_;
46 base::FilePath base_directory_;
47 StrongBinding<ServiceCache> binding_;
48
49 DISALLOW_COPY_AND_ASSIGN(ServiceCacheImpl);
50 };
51
52 } // namespace service_cache
53 } // namespace mojo
54
55 #endif // SERVICES_SERVICE_CACHE_SERVICE_CACHE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698