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_SUBRESOURCE_URL_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_SUBRESOURCE_URL_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_SUBRESOURCE_URL_FACTORY_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_SUBRESOURCE_URL_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | |
| 9 #include "content/common/url_loader_factory.mojom.h" | 10 #include "content/common/url_loader_factory.mojom.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "net/traffic_annotation/network_traffic_annotation.h" | 12 #include "net/traffic_annotation/network_traffic_annotation.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 17 class AppCacheHost; | |
| 16 class AppCacheJob; | 18 class AppCacheJob; |
| 17 class AppCacheServiceImpl; | 19 class AppCacheServiceImpl; |
| 18 class URLLoaderFactoryGetter; | 20 class URLLoaderFactoryGetter; |
| 19 | 21 |
| 20 // Implements the URLLoaderFactory mojom for AppCache subresource requests. | 22 // Implements the URLLoaderFactory mojom for AppCache subresource requests. |
| 21 class AppCacheSubresourceURLFactory : public mojom::URLLoaderFactory { | 23 class AppCacheSubresourceURLFactory : public mojom::URLLoaderFactory { |
| 22 public: | 24 public: |
| 23 ~AppCacheSubresourceURLFactory() override; | 25 ~AppCacheSubresourceURLFactory() override; |
| 24 | 26 |
| 25 // Factory function to create an instance of the factory. | 27 // Factory function to create an instance of the factory. |
| 26 // 1. The |factory_getter| parameter is used to query the network service | 28 // 1. The |factory_getter| parameter is used to query the network service |
| 27 // to pass network requests to. | 29 // to pass network requests to. |
| 30 // 2. The |frame_tree_node_id| parameter contains the FrameTreeNodeId for the | |
|
kinuko
2017/07/03 06:34:15
Do you mean to mention |host| in the latest patch
ananta
2017/07/03 07:36:47
Done.
| |
| 31 // frame. | |
| 32 // Returns the AppCacheSubresourceURLFactory instance. The URLLoaderFactoryPtr | |
| 33 // is returned in the |loader_factory| parameter. | |
| 28 // Returns a URLLoaderFactoryPtr instance which controls the lifetime of the | 34 // Returns a URLLoaderFactoryPtr instance which controls the lifetime of the |
| 29 // factory. | 35 // factory. |
| 30 static mojom::URLLoaderFactoryPtr CreateURLLoaderFactory( | 36 static AppCacheSubresourceURLFactory* CreateURLLoaderFactory( |
| 31 URLLoaderFactoryGetter* factory_getter); | 37 URLLoaderFactoryGetter* factory_getter, |
| 38 base::WeakPtr<AppCacheHost> host, | |
| 39 mojom::URLLoaderFactoryPtr* loader_factory); | |
| 32 | 40 |
| 33 // mojom::URLLoaderFactory implementation. | 41 // mojom::URLLoaderFactory implementation. |
| 34 void CreateLoaderAndStart( | 42 void CreateLoaderAndStart( |
| 35 mojom::URLLoaderAssociatedRequest url_loader_request, | 43 mojom::URLLoaderAssociatedRequest url_loader_request, |
| 36 int32_t routing_id, | 44 int32_t routing_id, |
| 37 int32_t request_id, | 45 int32_t request_id, |
| 38 uint32_t options, | 46 uint32_t options, |
| 39 const ResourceRequest& request, | 47 const ResourceRequest& request, |
| 40 mojom::URLLoaderClientPtr client, | 48 mojom::URLLoaderClientPtr client, |
| 41 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) | 49 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) |
| 42 override; | 50 override; |
| 43 void SyncLoad(int32_t routing_id, | 51 void SyncLoad(int32_t routing_id, |
| 44 int32_t request_id, | 52 int32_t request_id, |
| 45 const ResourceRequest& request, | 53 const ResourceRequest& request, |
| 46 SyncLoadCallback callback) override; | 54 SyncLoadCallback callback) override; |
| 47 | 55 |
| 48 private: | 56 private: |
| 49 AppCacheSubresourceURLFactory(mojom::URLLoaderFactoryRequest request, | 57 AppCacheSubresourceURLFactory(mojom::URLLoaderFactoryRequest request, |
| 50 URLLoaderFactoryGetter* factory_getter); | 58 URLLoaderFactoryGetter* factory_getter, |
| 59 base::WeakPtr<AppCacheHost> host); | |
| 51 | 60 |
| 52 void OnConnectionError(); | 61 void OnConnectionError(); |
| 53 | 62 |
| 54 // Mojo binding. | 63 // Mojo binding. |
| 55 mojo::Binding<mojom::URLLoaderFactory> binding_; | 64 mojo::Binding<mojom::URLLoaderFactory> binding_; |
| 56 | 65 |
| 57 // Used to retrieve the network service factory to pass unhandled requests to | 66 // Used to retrieve the network service factory to pass unhandled requests to |
| 58 // the network service. | 67 // the network service. |
| 59 scoped_refptr<URLLoaderFactoryGetter> default_url_loader_factory_getter_; | 68 scoped_refptr<URLLoaderFactoryGetter> default_url_loader_factory_getter_; |
| 60 | 69 |
| 70 base::WeakPtr<AppCacheHost> appcache_host_; | |
| 71 | |
| 61 DISALLOW_COPY_AND_ASSIGN(AppCacheSubresourceURLFactory); | 72 DISALLOW_COPY_AND_ASSIGN(AppCacheSubresourceURLFactory); |
| 62 }; | 73 }; |
| 63 | 74 |
| 64 } // namespace content | 75 } // namespace content |
| 65 | 76 |
| 66 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ | 77 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ |
| OLD | NEW |