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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h"
10 #include "content/common/url_loader_factory.mojom.h"
11 #include "content/public/common/resource_type.h"
jam 2017/05/17 16:51:12 nit: unneeded?
ananta 2017/05/17 18:14:08 Removed.
12 #include "mojo/public/cpp/bindings/binding_set.h"
jam 2017/05/17 16:51:12 ditto
ananta 2017/05/17 18:14:09 Removed
13 #include "mojo/public/cpp/bindings/strong_binding_set.h"
14 #include "url/gurl.h"
15
16 namespace content {
17 class ChromeAppCacheService;
18 class URLLoaderFactoryGetter;
19
20 // Implements the URLLoaderFactory mojom for AppCache requests.
21 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.
22 public:
23 ~AppCacheURLLoaderFactory() override;
24
25 // Factory function to create an instance of the factory.
26 // The |appcache_service| parameter is used to query the underlying
27 // AppCacheStorage instance to check if we can service requests from the
28 // AppCache. We pass unhandled requests to the network service retrieved from
29 // the |factory_getter|.
30 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request,
31 ChromeAppCacheService* appcache_service,
32 URLLoaderFactoryGetter* factory_getter);
33
34 void CreateLoaderAndStart(
35 mojom::URLLoaderAssociatedRequest url_loader_request,
36 int32_t routing_id,
37 int32_t request_id,
38 uint32_t options,
39 const ResourceRequest& request,
40 mojom::URLLoaderClientPtr client) override;
41
jam 2017/05/17 16:51:12 nit: no blank line between overrridden methods (al
ananta 2017/05/17 18:14:08 Done.
42 void SyncLoad(int32_t routing_id,
43 int32_t request_id,
44 const ResourceRequest& request,
45 SyncLoadCallback callback) override;
46
47 private:
48 AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service,
49 URLLoaderFactoryGetter* factory_getter);
50
51 void StartURLLoader(const ResourceRequest& request,
52 mojom::URLLoaderAssociatedRequest url_loader_request,
53 int32_t routing_id,
54 int32_t request_id,
55 mojom::URLLoaderClientPtr client_info);
56
57 // Used to query AppCacheStorage to see if a request can be served out of the
58 /// AppCache.
59 scoped_refptr<ChromeAppCacheService> appcache_service_;
60
61 // Used to retrieve the network service factory to pass unhandled requests to
62 // the network service.
63 scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
64
65 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
66
67 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory);
68 };
69
70 } // namespace content
71
72 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698