| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHILD_WEB_URL_LOADER_IMPL_H_ | 5 #ifndef CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ |
| 6 #define CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ | 6 #define CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "content/common/url_loader_factory.mojom.h" | 12 #include "content/common/url_loader_factory.mojom.h" |
| 12 #include "content/public/common/resource_response.h" | 13 #include "content/public/common/resource_response.h" |
| 13 #include "mojo/public/cpp/system/data_pipe.h" | 14 #include "mojo/public/cpp/system/data_pipe.h" |
| 14 #include "net/url_request/redirect_info.h" | 15 #include "net/url_request/redirect_info.h" |
| 15 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 16 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
| 16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 class ResourceDispatcher; | 21 class ResourceDispatcher; |
| 21 struct ResourceResponseInfo; | 22 struct ResourceResponseInfo; |
| 22 | 23 |
| 23 // PlzNavigate: Used to override parameters of the navigation request. | 24 // PlzNavigate: Used to override parameters of the navigation request. |
| 24 struct CONTENT_EXPORT StreamOverrideParameters { | 25 struct CONTENT_EXPORT StreamOverrideParameters { |
| 25 public: | 26 public: |
| 26 StreamOverrideParameters(); | 27 StreamOverrideParameters(); |
| 27 ~StreamOverrideParameters(); | 28 ~StreamOverrideParameters(); |
| 28 // TODO(clamy): The browser should be made aware on destruction of this struct | 29 |
| 29 // that it can release its associated stream handle. | |
| 30 GURL stream_url; | 30 GURL stream_url; |
| 31 mojo::ScopedDataPipeConsumerHandle consumer_handle; | 31 mojo::ScopedDataPipeConsumerHandle consumer_handle; |
| 32 ResourceResponseHead response; | 32 ResourceResponseHead response; |
| 33 std::vector<GURL> redirects; | 33 std::vector<GURL> redirects; |
| 34 std::vector<ResourceResponseInfo> redirect_responses; | 34 std::vector<ResourceResponseInfo> redirect_responses; |
| 35 std::vector<net::RedirectInfo> redirect_infos; | 35 std::vector<net::RedirectInfo> redirect_infos; |
| 36 | 36 |
| 37 // The delta between the actual transfer size and the one reported by the | 37 // The delta between the actual transfer size and the one reported by the |
| 38 // AsyncResourceLoader due to not having the ResourceResponse. | 38 // AsyncResourceLoader due to not having the ResourceResponse. |
| 39 int total_transfer_size_delta; | 39 int total_transfer_size_delta; |
| 40 | 40 |
| 41 int total_transferred = 0; | 41 int total_transferred = 0; |
| 42 |
| 43 // Called when this struct is deleted. Used to notify the browser that it can |
| 44 // release its associated StreamHandle. |
| 45 base::OnceCallback<void(const GURL&)> on_delete; |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 class CONTENT_EXPORT WebURLLoaderImpl | 48 class CONTENT_EXPORT WebURLLoaderImpl |
| 45 : public NON_EXPORTED_BASE(blink::WebURLLoader) { | 49 : public NON_EXPORTED_BASE(blink::WebURLLoader) { |
| 46 public: | 50 public: |
| 47 | 51 |
| 48 // Takes ownership of |web_task_runner|. | 52 // Takes ownership of |web_task_runner|. |
| 49 WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher, | 53 WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher, |
| 50 mojom::URLLoaderFactory* url_loader_factory); | 54 mojom::URLLoaderFactory* url_loader_factory); |
| 51 ~WebURLLoaderImpl() override; | 55 ~WebURLLoaderImpl() override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 79 class Context; | 83 class Context; |
| 80 class RequestPeerImpl; | 84 class RequestPeerImpl; |
| 81 scoped_refptr<Context> context_; | 85 scoped_refptr<Context> context_; |
| 82 | 86 |
| 83 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderImpl); | 87 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderImpl); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace content | 90 } // namespace content |
| 87 | 91 |
| 88 #endif // CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ | 92 #endif // CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ |
| OLD | NEW |