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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 size_t iter = 0; | 98 size_t iter = 0; |
99 std::string name; | 99 std::string name; |
100 std::string value; | 100 std::string value; |
101 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | 101 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { |
102 response.addHTTPHeaderField(WebString::fromLatin1(name), | 102 response.addHTTPHeaderField(WebString::fromLatin1(name), |
103 WebString::fromLatin1(value)); | 103 WebString::fromLatin1(value)); |
104 } | 104 } |
105 return data; | 105 return data; |
106 } | 106 } |
107 | 107 |
| 108 PLATFORM_EXPORT bool getDataURLMimeType(const KURL& url, |
| 109 AtomicString& mimetype, |
| 110 bool* isSupportedMimeType) { |
| 111 std::string utf8MimeType; |
| 112 std::string utf8Charset; |
| 113 if (net::DataURL::Parse(WebStringToGURL(url.getString()), &utf8MimeType, |
| 114 &utf8Charset, nullptr)) { |
| 115 *isSupportedMimeType = mime_util::IsSupportedMimeType(utf8MimeType); |
| 116 return true; |
| 117 } |
| 118 return false; |
| 119 } |
| 120 |
108 bool isRedirectResponseCode(int responseCode) { | 121 bool isRedirectResponseCode(int responseCode) { |
109 return net::HttpResponseHeaders::IsRedirectResponseCode(responseCode); | 122 return net::HttpResponseHeaders::IsRedirectResponseCode(responseCode); |
110 } | 123 } |
111 | 124 |
112 } // NetworkUtils | 125 } // NetworkUtils |
113 | 126 |
114 } // namespace blink | 127 } // namespace blink |
OLD | NEW |