| 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 "components/html_viewer/blink_platform_impl.h" | 5 #include "components/html_viewer/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "components/html_viewer/blink_resource_constants.h" | 15 #include "components/html_viewer/blink_resource_constants.h" |
| 16 #include "components/html_viewer/web_clipboard_impl.h" | 16 #include "components/html_viewer/web_clipboard_impl.h" |
| 17 #include "components/html_viewer/web_cookie_jar_impl.h" | 17 #include "components/html_viewer/web_cookie_jar_impl.h" |
| 18 #include "components/html_viewer/web_message_port_channel_impl.h" | 18 #include "components/html_viewer/web_message_port_channel_impl.h" |
| 19 #include "components/html_viewer/web_socket_handle_impl.h" | 19 #include "components/html_viewer/web_socket_handle_impl.h" |
| 20 #include "components/html_viewer/web_thread_impl.h" | 20 #include "components/html_viewer/web_thread_impl.h" |
| 21 #include "components/html_viewer/web_url_loader_impl.h" | 21 #include "components/html_viewer/web_url_loader_impl.h" |
| 22 #include "components/mime_util/mime_util.h" |
| 22 #include "net/base/data_url.h" | 23 #include "net/base/data_url.h" |
| 23 #include "net/base/mime_util.h" | |
| 24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 26 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 26 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 27 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" | 27 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" |
| 28 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" | 28 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" |
| 29 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 29 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
| 30 | 30 |
| 31 namespace html_viewer { | 31 namespace html_viewer { |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 command_line->GetSwitchValueASCII(kUserAgentSwitch)); | 222 command_line->GetSwitchValueASCII(kUserAgentSwitch)); |
| 223 } | 223 } |
| 224 return blink::WebString::fromUTF8(kDefaultUserAgentString); | 224 return blink::WebString::fromUTF8(kDefaultUserAgentString); |
| 225 } | 225 } |
| 226 | 226 |
| 227 blink::WebData BlinkPlatformImpl::parseDataURL( | 227 blink::WebData BlinkPlatformImpl::parseDataURL( |
| 228 const blink::WebURL& url, | 228 const blink::WebURL& url, |
| 229 blink::WebString& mimetype_out, | 229 blink::WebString& mimetype_out, |
| 230 blink::WebString& charset_out) { | 230 blink::WebString& charset_out) { |
| 231 std::string mimetype, charset, data; | 231 std::string mimetype, charset, data; |
| 232 if (net::DataURL::Parse(url, &mimetype, &charset, &data) | 232 if (net::DataURL::Parse(url, &mimetype, &charset, &data) && |
| 233 && net::IsSupportedMimeType(mimetype)) { | 233 mime_util::IsSupportedMimeType(mimetype)) { |
| 234 mimetype_out = blink::WebString::fromUTF8(mimetype); | 234 mimetype_out = blink::WebString::fromUTF8(mimetype); |
| 235 charset_out = blink::WebString::fromUTF8(charset); | 235 charset_out = blink::WebString::fromUTF8(charset); |
| 236 return data; | 236 return data; |
| 237 } | 237 } |
| 238 return blink::WebData(); | 238 return blink::WebData(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 blink::WebURLError BlinkPlatformImpl::cancelledError(const blink::WebURL& url) | 241 blink::WebURLError BlinkPlatformImpl::cancelledError(const blink::WebURL& url) |
| 242 const { | 242 const { |
| 243 blink::WebURLError error; | 243 blink::WebURLError error; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 317 } |
| 318 | 318 |
| 319 // static | 319 // static |
| 320 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 320 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 321 WebThreadImplForMessageLoop* impl = | 321 WebThreadImplForMessageLoop* impl = |
| 322 static_cast<WebThreadImplForMessageLoop*>(thread); | 322 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 323 delete impl; | 323 delete impl; |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace html_viewer | 326 } // namespace html_viewer |
| OLD | NEW |