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 "content/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 WebString BlinkPlatformImpl::userAgent() { | 426 WebString BlinkPlatformImpl::userAgent() { |
427 CR_DEFINE_STATIC_LOCAL( | 427 CR_DEFINE_STATIC_LOCAL( |
428 blink::WebString, user_agent, | 428 blink::WebString, user_agent, |
429 (blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()))); | 429 (blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()))); |
430 DCHECK(user_agent == | 430 DCHECK(user_agent == |
431 blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())); | 431 blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())); |
432 return user_agent; | 432 return user_agent; |
433 } | 433 } |
434 | 434 |
435 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url, | 435 bool BlinkPlatformImpl::parseDataURLIfCanBeHandledLocally( |
436 WebString& mimetype_out, | 436 const blink::WebURLRequest& request, |
437 WebString& charset_out) { | 437 WebString& mimetype_out, |
| 438 WebString& charset_out, |
| 439 WebData& data_out) { |
| 440 // |resource_dispatcher_exists| is a workaround for RenderViewImplTest |
| 441 // (https://crbug.com/187500). We set it to |true| when used from Blink. |
| 442 if (!WebURLLoaderImpl::CanHandleDataURLRequestLocally(request, true)) |
| 443 return false; |
| 444 |
438 std::string mime_type, char_set, data; | 445 std::string mime_type, char_set, data; |
439 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && | 446 if (net::DataURL::Parse(request.url(), &mime_type, &char_set, &data)) { |
440 mime_util::IsSupportedMimeType(mime_type)) { | |
441 mimetype_out = WebString::fromUTF8(mime_type); | 447 mimetype_out = WebString::fromUTF8(mime_type); |
442 charset_out = WebString::fromUTF8(char_set); | 448 charset_out = WebString::fromUTF8(char_set); |
443 return data; | 449 data_out = data; |
| 450 } else { |
| 451 data_out = WebData(); |
444 } | 452 } |
445 return WebData(); | 453 return true; |
446 } | 454 } |
447 | 455 |
448 WebURLError BlinkPlatformImpl::cancelledError( | 456 WebURLError BlinkPlatformImpl::cancelledError( |
449 const WebURL& unreachableURL) const { | 457 const WebURL& unreachableURL) const { |
450 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); | 458 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); |
451 } | 459 } |
452 | 460 |
453 bool BlinkPlatformImpl::isReservedIPAddress( | 461 bool BlinkPlatformImpl::isReservedIPAddress( |
454 const blink::WebString& host) const { | 462 const blink::WebString& host) const { |
455 net::IPAddressNumber address; | 463 net::IPAddressNumber address; |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1025 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
1018 static_cast<ui::DomKey>(dom_key))); | 1026 static_cast<ui::DomKey>(dom_key))); |
1019 } | 1027 } |
1020 | 1028 |
1021 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1029 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
1022 return static_cast<int>( | 1030 return static_cast<int>( |
1023 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1031 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
1024 } | 1032 } |
1025 | 1033 |
1026 } // namespace content | 1034 } // namespace content |
OLD | NEW |