| 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 "mojo/examples/html_viewer/weburlloader_impl.h" | 5 #include "mojo/services/html_viewer/weburlloader_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/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "mojo/common/common_type_converters.h" | 10 #include "mojo/common/common_type_converters.h" |
| 11 #include "mojo/services/public/interfaces/network/network_service.mojom.h" | 11 #include "mojo/services/public/interfaces/network/network_service.mojom.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "third_party/WebKit/public/platform/WebURLError.h" | 13 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 14 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h" | 14 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h" |
| 15 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 15 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
| 16 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 16 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 17 | 17 |
| 18 namespace mojo { | 18 namespace mojo { |
| 19 namespace examples { | |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 blink::WebURLResponse ToWebURLResponse(const URLResponsePtr& url_response) { | 21 blink::WebURLResponse ToWebURLResponse(const URLResponsePtr& url_response) { |
| 23 blink::WebURLResponse result; | 22 blink::WebURLResponse result; |
| 24 result.initialize(); | 23 result.initialize(); |
| 25 result.setURL(GURL(url_response->url)); | 24 result.setURL(GURL(url_response->url)); |
| 26 result.setMIMEType(blink::WebString::fromUTF8(url_response->mime_type)); | 25 result.setMIMEType(blink::WebString::fromUTF8(url_response->mime_type)); |
| 27 result.setTextEncodingName(blink::WebString::fromUTF8(url_response->charset)); | 26 result.setTextEncodingName(blink::WebString::fromUTF8(url_response->charset)); |
| 28 result.setHTTPStatusCode(url_response->status_code); | 27 result.setHTTPStatusCode(url_response->status_code); |
| 29 | 28 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 MOJO_HANDLE_SIGNAL_READABLE, | 179 MOJO_HANDLE_SIGNAL_READABLE, |
| 181 MOJO_DEADLINE_INDEFINITE, | 180 MOJO_DEADLINE_INDEFINITE, |
| 182 base::Bind(&WebURLLoaderImpl::OnResponseBodyStreamReady, | 181 base::Bind(&WebURLLoaderImpl::OnResponseBodyStreamReady, |
| 183 weak_factory_.GetWeakPtr())); | 182 weak_factory_.GetWeakPtr())); |
| 184 } | 183 } |
| 185 | 184 |
| 186 void WebURLLoaderImpl::OnResponseBodyStreamReady(MojoResult result) { | 185 void WebURLLoaderImpl::OnResponseBodyStreamReady(MojoResult result) { |
| 187 ReadMore(); | 186 ReadMore(); |
| 188 } | 187 } |
| 189 | 188 |
| 190 } // namespace examples | |
| 191 } // namespace mojo | 189 } // namespace mojo |
| OLD | NEW |