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 #include "components/html_viewer/web_url_loader_impl.h" | 5 #include "components/html_viewer/web_url_loader_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
12 #include "components/html_viewer/blink_url_request_type_converters.h" | 12 #include "components/html_viewer/blink_url_request_type_converters.h" |
13 #include "mojo/common/common_type_converters.h" | 13 #include "mojo/common/common_type_converters.h" |
14 #include "mojo/common/url_type_converters.h" | 14 #include "mojo/common/url_type_converters.h" |
15 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | 15 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "third_party/WebKit/public/platform/WebURLError.h" | 17 #include "third_party/WebKit/public/platform/WebURLError.h" |
18 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h" | 18 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h" |
19 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 19 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
20 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 20 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
21 | 21 |
22 using blink::WebString; | 22 using blink::WebString; |
23 using mojo::URLResponsePtr; | 23 using mojo::URLResponsePtr; |
24 | 24 |
25 namespace html_viewer { | 25 namespace html_viewer { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 WebURLRequestExtraData::WebURLRequestExtraData() { | 68 WebURLRequestExtraData::WebURLRequestExtraData() { |
69 } | 69 } |
70 | 70 |
71 WebURLRequestExtraData::~WebURLRequestExtraData() { | 71 WebURLRequestExtraData::~WebURLRequestExtraData() { |
72 } | 72 } |
73 | 73 |
74 WebURLLoaderImpl::WebURLLoaderImpl(mojo::NetworkService* network_service, | 74 WebURLLoaderImpl::WebURLLoaderImpl(mojo::URLLoaderFactory* url_loader_factory, |
75 MockWebBlobRegistryImpl* web_blob_registry) | 75 MockWebBlobRegistryImpl* web_blob_registry) |
76 : client_(NULL), | 76 : client_(NULL), |
77 web_blob_registry_(web_blob_registry), | 77 web_blob_registry_(web_blob_registry), |
78 referrer_policy_(blink::WebReferrerPolicyDefault), | 78 referrer_policy_(blink::WebReferrerPolicyDefault), |
79 weak_factory_(this) { | 79 weak_factory_(this) { |
80 network_service->CreateURLLoader(GetProxy(&url_loader_)); | 80 url_loader_factory->CreateURLLoader(GetProxy(&url_loader_)); |
81 } | 81 } |
82 | 82 |
83 WebURLLoaderImpl::~WebURLLoaderImpl() { | 83 WebURLLoaderImpl::~WebURLLoaderImpl() { |
84 } | 84 } |
85 | 85 |
86 void WebURLLoaderImpl::loadSynchronously( | 86 void WebURLLoaderImpl::loadSynchronously( |
87 const blink::WebURLRequest& request, | 87 const blink::WebURLRequest& request, |
88 blink::WebURLResponse& response, | 88 blink::WebURLResponse& response, |
89 blink::WebURLError& error, | 89 blink::WebURLError& error, |
90 blink::WebData& data) { | 90 blink::WebData& data) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 MOJO_DEADLINE_INDEFINITE, | 284 MOJO_DEADLINE_INDEFINITE, |
285 base::Bind(&WebURLLoaderImpl::OnResponseBodyStreamReady, | 285 base::Bind(&WebURLLoaderImpl::OnResponseBodyStreamReady, |
286 weak_factory_.GetWeakPtr())); | 286 weak_factory_.GetWeakPtr())); |
287 } | 287 } |
288 | 288 |
289 void WebURLLoaderImpl::OnResponseBodyStreamReady(MojoResult result) { | 289 void WebURLLoaderImpl::OnResponseBodyStreamReady(MojoResult result) { |
290 ReadMore(); | 290 ReadMore(); |
291 } | 291 } |
292 | 292 |
293 } // namespace html_viewer | 293 } // namespace html_viewer |
OLD | NEW |