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

Unified Diff: content/browser/appcache/appcache_url_loader_factory.h

Issue 2891773002: Add a stub implementation of the URLLoaderFactory for AppCache. (Closed)
Patch Set: Address final round of comments Created 3 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: content/browser/appcache/appcache_url_loader_factory.h
diff --git a/content/browser/appcache/appcache_url_loader_factory.h b/content/browser/appcache/appcache_url_loader_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..514c25ed7e4f9ff419ad5853242e153a725ebfd3
--- /dev/null
+++ b/content/browser/appcache/appcache_url_loader_factory.h
@@ -0,0 +1,63 @@
+// Copyright 2017 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 CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
+#define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
+
+#include "base/memory/ref_counted.h"
+#include "content/common/url_loader_factory.mojom.h"
+#include "mojo/public/cpp/bindings/strong_binding_set.h"
+#include "url/gurl.h"
+
+namespace content {
+class ChromeAppCacheService;
+class URLLoaderFactoryGetter;
+
+// Implements the URLLoaderFactory mojom for AppCache requests.
+class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory {
+ public:
+ ~AppCacheURLLoaderFactory() override;
+
+ // Factory function to create an instance of the factory.
+ // The |appcache_service| parameter is used to query the underlying
+ // AppCacheStorage instance to check if we can service requests from the
+ // AppCache. We pass unhandled requests to the network service retrieved from
+ // the |factory_getter|.
+ static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request,
+ ChromeAppCacheService* appcache_service,
+ URLLoaderFactoryGetter* factory_getter);
+
+ // mojom::URLLoaderFactory implementation.
+ void CreateLoaderAndStart(
+ mojom::URLLoaderAssociatedRequest url_loader_request,
+ int32_t routing_id,
+ int32_t request_id,
+ uint32_t options,
+ const ResourceRequest& request,
+ mojom::URLLoaderClientPtr client) override;
+ void SyncLoad(int32_t routing_id,
+ int32_t request_id,
+ const ResourceRequest& request,
+ SyncLoadCallback callback) override;
+
+ private:
+ AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service,
+ URLLoaderFactoryGetter* factory_getter);
+
+ // Used to query AppCacheStorage to see if a request can be served out of the
+ /// AppCache.
+ scoped_refptr<ChromeAppCacheService> appcache_service_;
+
+ // Used to retrieve the network service factory to pass unhandled requests to
+ // the network service.
+ scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
+
+ mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
« no previous file with comments | « content/browser/appcache/appcache_request_handler.cc ('k') | content/browser/appcache/appcache_url_loader_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698