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

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: Fix compile failures 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 AppCacheNavigationHandleCore;
15 class AppCacheURLLoader;
14 class ChromeAppCacheService; 16 class ChromeAppCacheService;
15 class URLLoaderFactoryGetter; 17 class URLLoaderFactoryGetter;
18 class URLLoaderRequestHandler;
16 19
17 // Implements the URLLoaderFactory mojom for AppCache requests. 20 // Implements the URLLoaderFactory mojom for AppCache requests.
18 class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory { 21 class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory {
19 public: 22 public:
20 ~AppCacheURLLoaderFactory() override; 23 ~AppCacheURLLoaderFactory() override;
21 24
22 // Factory function to create an instance of the factory. 25 // Factory function to create an instance of the factory.
23 // The |appcache_service| parameter is used to query the underlying 26 // 1. The |appcache_service| parameter is passed to the URLLoader mojom for
24 // AppCacheStorage instance to check if we can service requests from the 27 // checking if the request can be serviced from the AppCache.
25 // AppCache. We pass unhandled requests to the network service retrieved from 28 // 2. The |factory_getter| parameter is used to query the network service
26 // the |factory_getter|. 29 // to pass network requests to.
30 // 3. The |navigation_url_loader| is valid only for navigation requests. In
31 // other cases like subresource requests we create an instance of the
32 // AppCacheURLLoader class to handle the request.
33 // 4. The process_id parameter identifies the process. 0 for browser
34 // initiated requests.
27 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request, 35 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request,
jam 2017/06/01 15:00:46 this isn't called externally anymore, so no need t
ananta 2017/06/01 17:28:01 The static function uses the loader_factory_bindin
28 ChromeAppCacheService* appcache_service, 36 ChromeAppCacheService* appcache_service,
29 URLLoaderFactoryGetter* factory_getter); 37 URLLoaderFactoryGetter* factory_getter,
38 AppCacheURLLoader* navigation_url_loader,
39 int process_id);
40
41 // Creates an instance of the URLLoaderRequestHandler subclass to see if we
42 // can serve this request from the AppCache.
43 static std::unique_ptr<URLLoaderRequestHandler> CreateRequestHandler(
44 AppCacheNavigationHandleCore* appcache_handle_core,
45 URLLoaderFactoryGetter* url_loader_factory_getter);
30 46
31 // mojom::URLLoaderFactory implementation. 47 // mojom::URLLoaderFactory implementation.
32 void CreateLoaderAndStart(mojom::URLLoaderRequest url_loader_request, 48 void CreateLoaderAndStart(mojom::URLLoaderRequest url_loader_request,
33 int32_t routing_id, 49 int32_t routing_id,
34 int32_t request_id, 50 int32_t request_id,
35 uint32_t options, 51 uint32_t options,
36 const ResourceRequest& request, 52 const ResourceRequest& request,
37 mojom::URLLoaderClientPtr client) override; 53 mojom::URLLoaderClientPtr client) override;
38 void SyncLoad(int32_t routing_id, 54 void SyncLoad(int32_t routing_id,
39 int32_t request_id, 55 int32_t request_id,
40 const ResourceRequest& request, 56 const ResourceRequest& request,
41 SyncLoadCallback callback) override; 57 SyncLoadCallback callback) override;
42 58
43 private: 59 private:
44 AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service, 60 AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service,
45 URLLoaderFactoryGetter* factory_getter); 61 URLLoaderFactoryGetter* factory_getter,
62 AppCacheURLLoader* url_loader_instance,
63 int process_id);
46 64
47 // Used to query AppCacheStorage to see if a request can be served out of the 65 // Used to query AppCacheStorage to see if a request can be served out of the
48 /// AppCache. 66 /// AppCache.
49 scoped_refptr<ChromeAppCacheService> appcache_service_; 67 scoped_refptr<ChromeAppCacheService> appcache_service_;
50 68
51 // Used to retrieve the network service factory to pass unhandled requests to 69 // Used to retrieve the network service factory to pass unhandled requests to
52 // the network service. 70 // the network service.
53 scoped_refptr<URLLoaderFactoryGetter> factory_getter_; 71 scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
54 72
73 // Only set for navigation requests.
74 AppCacheURLLoader* navigation_url_loader_;
75
76 // Process id. 0 for browser.
77 int process_id_;
78
55 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; 79 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
56 80
57 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory); 81 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory);
58 }; 82 };
59 83
60 } // namespace content 84 } // namespace content
61 85
62 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ 86 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698