OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/network/NetworkUtils.h" | 5 #include "platform/network/NetworkUtils.h" |
6 | 6 |
7 #include "components/mime_util/mime_util.h" | 7 #include "components/mime_util/mime_util.h" |
8 #include "net/base/data_url.h" | 8 #include "net/base/data_url.h" |
9 #include "net/base/ip_address.h" | 9 #include "net/base/ip_address.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (net::DataURL::Parse(WebStringToGURL(url.getString()), &utf8MimeType, | 71 if (net::DataURL::Parse(WebStringToGURL(url.getString()), &utf8MimeType, |
72 &utf8Charset, &data) && | 72 &utf8Charset, &data) && |
73 mime_util::IsSupportedMimeType(utf8MimeType)) { | 73 mime_util::IsSupportedMimeType(utf8MimeType)) { |
74 mimetype = WebString::fromUTF8(utf8MimeType); | 74 mimetype = WebString::fromUTF8(utf8MimeType); |
75 charset = WebString::fromUTF8(utf8Charset); | 75 charset = WebString::fromUTF8(utf8Charset); |
76 return SharedBuffer::create(data.data(), data.size()); | 76 return SharedBuffer::create(data.data(), data.size()); |
77 } | 77 } |
78 return nullptr; | 78 return nullptr; |
79 } | 79 } |
80 | 80 |
| 81 PLATFORM_EXPORT bool getDataURLMimeType(const KURL& url, |
| 82 AtomicString& mimetype, |
| 83 bool* isSupportedMimeType) { |
| 84 std::string utf8MimeType; |
| 85 std::string utf8Charset; |
| 86 if (net::DataURL::Parse(WebStringToGURL(url.getString()), &utf8MimeType, |
| 87 &utf8Charset, nullptr)) { |
| 88 *isSupportedMimeType = mime_util::IsSupportedMimeType(utf8MimeType); |
| 89 return true; |
| 90 } |
| 91 return false; |
| 92 } |
| 93 |
81 bool isRedirectResponseCode(int responseCode) { | 94 bool isRedirectResponseCode(int responseCode) { |
82 return net::HttpResponseHeaders::IsRedirectResponseCode(responseCode); | 95 return net::HttpResponseHeaders::IsRedirectResponseCode(responseCode); |
83 } | 96 } |
84 | 97 |
85 } // NetworkUtils | 98 } // NetworkUtils |
86 | 99 |
87 } // namespace blink | 100 } // namespace blink |
OLD | NEW |