| 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 "sky/viewer/platform/platform_impl.h" | 5 #include "sky/viewer/platform/platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 mojo::NetworkService* PlatformImpl::networkService() { | 139 mojo::NetworkService* PlatformImpl::networkService() { |
| 140 return network_service_.get(); | 140 return network_service_.get(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 blink::WebURLLoader* PlatformImpl::createURLLoader() { | 143 blink::WebURLLoader* PlatformImpl::createURLLoader() { |
| 144 return new WebURLLoaderImpl(network_service_.get()); | 144 return new WebURLLoaderImpl(network_service_.get()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 blink::WebData PlatformImpl::parseDataURL( | |
| 148 const blink::WebURL& url, | |
| 149 blink::WebString& mimetype_out, | |
| 150 blink::WebString& charset_out) { | |
| 151 std::string mimetype, charset, data; | |
| 152 if (net::DataURL::Parse(url, &mimetype, &charset, &data) | |
| 153 && net::IsSupportedMimeType(mimetype)) { | |
| 154 mimetype_out = blink::WebString::fromUTF8(mimetype); | |
| 155 charset_out = blink::WebString::fromUTF8(charset); | |
| 156 return data; | |
| 157 } | |
| 158 return blink::WebData(); | |
| 159 } | |
| 160 | |
| 161 blink::WebURLError PlatformImpl::cancelledError(const blink::WebURL& url) | 147 blink::WebURLError PlatformImpl::cancelledError(const blink::WebURL& url) |
| 162 const { | 148 const { |
| 163 blink::WebURLError error; | 149 blink::WebURLError error; |
| 164 error.domain = blink::WebString::fromUTF8(net::kErrorDomain); | 150 error.domain = blink::WebString::fromUTF8(net::kErrorDomain); |
| 165 error.reason = net::ERR_ABORTED; | 151 error.reason = net::ERR_ABORTED; |
| 166 error.unreachableURL = url; | 152 error.unreachableURL = url; |
| 167 error.staleCopyInCache = false; | 153 error.staleCopyInCache = false; |
| 168 error.isCancellation = true; | 154 error.isCancellation = true; |
| 169 return error; | 155 return error; |
| 170 } | 156 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 const unsigned char* category_group_enabled, | 239 const unsigned char* category_group_enabled, |
| 254 const char* name, | 240 const char* name, |
| 255 TraceEventHandle handle) { | 241 TraceEventHandle handle) { |
| 256 base::debug::TraceEventHandle traceEventHandle; | 242 base::debug::TraceEventHandle traceEventHandle; |
| 257 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 243 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
| 258 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 244 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
| 259 category_group_enabled, name, traceEventHandle); | 245 category_group_enabled, name, traceEventHandle); |
| 260 } | 246 } |
| 261 | 247 |
| 262 } // namespace sky | 248 } // namespace sky |
| OLD | NEW |