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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: services/service_cache/service_cache_impl.h
diff --git a/services/service_cache/service_cache_impl.h b/services/service_cache/service_cache_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..b4035cfa22af6f9cfffdc77dca2957bb3e342385
--- /dev/null
+++ b/services/service_cache/service_cache_impl.h
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_SERVICE_CACHE_SERVICE_CACHE_IMPL_H_
+#define SERVICES_SERVICE_CACHE_SERVICE_CACHE_IMPL_H_
+
+#include "base/files/file_path.h"
+#include "base/macros.h"
+#include "base/threading/sequenced_worker_pool.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/services/service_cache/public/interfaces/service_cache.mojom.h"
+
+namespace mojo {
+namespace service_cache {
+
+class ServiceCacheImpl : public ServiceCache {
+ public:
+ using FilePathPairCallback =
+ base::Callback<void(const base::FilePath&, const base::FilePath&)>;
+
+ ServiceCacheImpl(scoped_refptr<base::SequencedWorkerPool> worker_pool,
+ const std::string& remote_application_url,
+ InterfaceRequest<ServiceCache> request);
+ ~ServiceCacheImpl() override;
+
+ private:
+ // ServiceCache
+ void GetFile(mojo::URLResponsePtr response,
+ const GetFileCallback& callback) override;
+ void GetExtractedContent(
+ mojo::URLResponsePtr response,
+ const GetExtractedContentCallback& callback) override;
+
+ void GetFileInternal(mojo::URLResponsePtr response,
+ const FilePathPairCallback& callback);
+
+ void GetExtractedContentInternal(const FilePathPairCallback& callback,
+ const base::FilePath& cache_dir,
+ const base::FilePath& content,
+ const base::FilePath& dir);
+
+ bool IsRequestAllowed(const mojo::URLResponsePtr& response);
+
+ scoped_refptr<base::SequencedWorkerPool> worker_pool_;
+ base::FilePath base_directory_;
+ StrongBinding<ServiceCache> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceCacheImpl);
+};
+
+} // namespace service_cache
+} // namespace mojo
+
+#endif // SERVICES_SERVICE_CACHE_SERVICE_CACHE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698