Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/binding.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 { |
|
michaeln
2017/06/09 01:48:29
This isn't used yet, can we remove the files from
ananta
2017/06/09 04:48:19
The URLLoader mojom in the appcache_url_loader_fac
| |
| 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 // Returns a URLLoaderFactoryPtr instance which controls the lifetime of the |
| 26 // the |factory_getter|. | 28 // factory. |
| 27 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request, | 29 static mojom::URLLoaderFactoryPtr CreateURLLoaderFactory( |
| 28 ChromeAppCacheService* appcache_service, | 30 URLLoaderFactoryGetter* factory_getter); |
| 29 URLLoaderFactoryGetter* factory_getter); | |
| 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(mojom::URLLoaderFactoryRequest request, |
| 46 URLLoaderFactoryGetter* factory_getter); | 47 URLLoaderFactoryGetter* factory_getter); |
| 47 | 48 |
| 48 // Used to query AppCacheStorage to see if a request can be served out of the | 49 void OnConnectionError(); |
| 49 /// AppCache. | 50 |
| 50 scoped_refptr<ChromeAppCacheService> appcache_service_; | 51 // Mojo binding. |
| 52 mojo::Binding<mojom::URLLoaderFactory> binding_; | |
| 51 | 53 |
| 52 // Used to retrieve the network service factory to pass unhandled requests to | 54 // Used to retrieve the network service factory to pass unhandled requests to |
| 53 // the network service. | 55 // the network service. |
| 54 scoped_refptr<URLLoaderFactoryGetter> factory_getter_; | 56 scoped_refptr<URLLoaderFactoryGetter> factory_getter_; |
| 55 | 57 |
| 56 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory); | 58 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace content | 61 } // namespace content |
| 62 | 62 |
| 63 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ | 63 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ |
| OLD | NEW |