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

Side by Side Diff: content/browser/appcache/appcache_url_loader_factory.h

Issue 2902653002: Get main frame and subframe AppCache loads to work. (Closed)
Patch Set: Another attempt at fixing redness Created 3 years, 6 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/common/url_loader_factory.mojom.h" 9 #include "content/common/url_loader_factory.mojom.h"
10 #include "mojo/public/cpp/bindings/strong_binding_set.h" 10 #include "mojo/public/cpp/bindings/strong_binding_set.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 namespace content { 13 namespace content {
14 class ChromeAppCacheService; 14
15 class AppCacheJob;
16 class AppCacheServiceImpl;
15 class URLLoaderFactoryGetter; 17 class URLLoaderFactoryGetter;
16 18
17 // Implements the URLLoaderFactory mojom for AppCache requests. 19 // Implements the URLLoaderFactory mojom for AppCache requests.
18 class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory { 20 class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory {
19 public: 21 public:
20 ~AppCacheURLLoaderFactory() override; 22 ~AppCacheURLLoaderFactory() override;
21 23
22 // Factory function to create an instance of the factory. 24 // Factory function to create an instance of the factory.
23 // The |appcache_service| parameter is used to query the underlying 25 // 1. The |factory_getter| parameter is used to query the network service
24 // AppCacheStorage instance to check if we can service requests from the 26 // to pass network requests to.
25 // AppCache. We pass unhandled requests to the network service retrieved from 27 // 2. The |url_loader_job| is valid only for navigation requests.
26 // the |factory_getter|.
27 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request, 28 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request,
28 ChromeAppCacheService* appcache_service, 29 URLLoaderFactoryGetter* factory_getter,
29 URLLoaderFactoryGetter* factory_getter); 30 AppCacheJob* url_loader_job);
30 31
31 // mojom::URLLoaderFactory implementation. 32 // mojom::URLLoaderFactory implementation.
32 void CreateLoaderAndStart( 33 void CreateLoaderAndStart(
33 mojom::URLLoaderAssociatedRequest url_loader_request, 34 mojom::URLLoaderAssociatedRequest url_loader_request,
34 int32_t routing_id, 35 int32_t routing_id,
35 int32_t request_id, 36 int32_t request_id,
36 uint32_t options, 37 uint32_t options,
37 const ResourceRequest& request, 38 const ResourceRequest& request,
38 mojom::URLLoaderClientPtr client) override; 39 mojom::URLLoaderClientPtr client) override;
39 void SyncLoad(int32_t routing_id, 40 void SyncLoad(int32_t routing_id,
40 int32_t request_id, 41 int32_t request_id,
41 const ResourceRequest& request, 42 const ResourceRequest& request,
42 SyncLoadCallback callback) override; 43 SyncLoadCallback callback) override;
43 44
44 private: 45 private:
45 AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service, 46 AppCacheURLLoaderFactory(URLLoaderFactoryGetter* factory_getter,
46 URLLoaderFactoryGetter* factory_getter); 47 AppCacheJob* url_loader_job);
47
48 // Used to query AppCacheStorage to see if a request can be served out of the
49 /// AppCache.
50 scoped_refptr<ChromeAppCacheService> appcache_service_;
51 48
52 // Used to retrieve the network service factory to pass unhandled requests to 49 // Used to retrieve the network service factory to pass unhandled requests to
53 // the network service. 50 // the network service.
54 scoped_refptr<URLLoaderFactoryGetter> factory_getter_; 51 scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
55 52
53 // Only set for navigation requests. We release ownership when the client
54 // binds to us.
55 std::unique_ptr<AppCacheJob> url_loader_job_;
56
56 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; 57 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
57 58
58 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory); 59 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory);
59 }; 60 };
60 61
61 } // namespace content 62 } // namespace content
62 63
63 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ 64 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698