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

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

Issue 2891773002: Add a stub implementation of the URLLoaderFactory for AppCache. (Closed)
Patch Set: Fix compile failures 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..f2097893447d18c110597f2b1d6e3b75ff18eba6
--- /dev/null
+++ b/content/browser/appcache/appcache_url_loader_factory.h
@@ -0,0 +1,72 @@
+// 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/content_export.h"
+#include "content/common/url_loader_factory.mojom.h"
+#include "content/public/common/resource_type.h"
jam 2017/05/17 16:51:12 nit: unneeded?
ananta 2017/05/17 18:14:08 Removed.
+#include "mojo/public/cpp/bindings/binding_set.h"
jam 2017/05/17 16:51:12 ditto
ananta 2017/05/17 18:14:09 Removed
+#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 CONTENT_EXPORT AppCacheURLLoaderFactory : public mojom::URLLoaderFactory {
jam 2017/05/17 16:51:12 nit: are you sure you need export?
ananta 2017/05/17 18:14:08 We don't need it now. I put that in for tests. If
jam 2017/05/18 14:16:14 please add it when it's needed
ananta 2017/05/18 19:13:52 Done.
+ 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);
+
+ 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;
+
jam 2017/05/17 16:51:12 nit: no blank line between overrridden methods (al
ananta 2017/05/17 18:14:08 Done.
+ void SyncLoad(int32_t routing_id,
+ int32_t request_id,
+ const ResourceRequest& request,
+ SyncLoadCallback callback) override;
+
+ private:
+ AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service,
+ URLLoaderFactoryGetter* factory_getter);
+
+ void StartURLLoader(const ResourceRequest& request,
+ mojom::URLLoaderAssociatedRequest url_loader_request,
+ int32_t routing_id,
+ int32_t request_id,
+ mojom::URLLoaderClientPtr client_info);
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698