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/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/html_viewer/blink_resource_constants.h" | 16 #include "components/html_viewer/blink_resource_constants.h" |
17 #include "components/html_viewer/web_clipboard_impl.h" | 17 #include "components/html_viewer/web_clipboard_impl.h" |
18 #include "components/html_viewer/web_cookie_jar_impl.h" | 18 #include "components/html_viewer/web_cookie_jar_impl.h" |
19 #include "components/html_viewer/web_message_port_channel_impl.h" | 19 #include "components/html_viewer/web_message_port_channel_impl.h" |
20 #include "components/html_viewer/web_socket_handle_impl.h" | 20 #include "components/html_viewer/web_socket_handle_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 "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 23 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
23 #include "components/scheduler/renderer/renderer_scheduler.h" | 24 #include "components/scheduler/renderer/renderer_scheduler.h" |
24 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | 25 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
25 #include "net/base/data_url.h" | 26 #include "net/base/data_url.h" |
26 #include "net/base/mime_util.h" | |
27 #include "net/base/net_errors.h" | 27 #include "net/base/net_errors.h" |
28 #include "net/base/net_util.h" | 28 #include "net/base/net_util.h" |
29 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 29 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
30 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" | 30 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" |
31 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" | 31 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" |
32 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 32 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
33 | 33 |
34 namespace html_viewer { | 34 namespace html_viewer { |
35 namespace { | 35 namespace { |
36 | 36 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 command_line->GetSwitchValueASCII(kUserAgentSwitch)); | 219 command_line->GetSwitchValueASCII(kUserAgentSwitch)); |
220 } | 220 } |
221 return blink::WebString::fromUTF8(kDefaultUserAgentString); | 221 return blink::WebString::fromUTF8(kDefaultUserAgentString); |
222 } | 222 } |
223 | 223 |
224 blink::WebData BlinkPlatformImpl::parseDataURL( | 224 blink::WebData BlinkPlatformImpl::parseDataURL( |
225 const blink::WebURL& url, | 225 const blink::WebURL& url, |
226 blink::WebString& mimetype_out, | 226 blink::WebString& mimetype_out, |
227 blink::WebString& charset_out) { | 227 blink::WebString& charset_out) { |
228 std::string mimetype, charset, data; | 228 std::string mimetype, charset, data; |
229 if (net::DataURL::Parse(url, &mimetype, &charset, &data) | 229 if (net::DataURL::Parse(url, &mimetype, &charset, &data) && |
230 && net::IsSupportedMimeType(mimetype)) { | 230 mime_util::IsSupportedMimeType(mimetype)) { |
231 mimetype_out = blink::WebString::fromUTF8(mimetype); | 231 mimetype_out = blink::WebString::fromUTF8(mimetype); |
232 charset_out = blink::WebString::fromUTF8(charset); | 232 charset_out = blink::WebString::fromUTF8(charset); |
233 return data; | 233 return data; |
234 } | 234 } |
235 return blink::WebData(); | 235 return blink::WebData(); |
236 } | 236 } |
237 | 237 |
238 blink::WebURLError BlinkPlatformImpl::cancelledError(const blink::WebURL& url) | 238 blink::WebURLError BlinkPlatformImpl::cancelledError(const blink::WebURL& url) |
239 const { | 239 const { |
240 blink::WebURLError error; | 240 blink::WebURLError error; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 BlinkPlatformImpl::notificationManager() { | 307 BlinkPlatformImpl::notificationManager() { |
308 return &web_notification_manager_; | 308 return &web_notification_manager_; |
309 } | 309 } |
310 | 310 |
311 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 311 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
312 DCHECK(!current_thread_slot_.Get()); | 312 DCHECK(!current_thread_slot_.Get()); |
313 current_thread_slot_.Set(thread); | 313 current_thread_slot_.Set(thread); |
314 } | 314 } |
315 | 315 |
316 } // namespace html_viewer | 316 } // namespace html_viewer |
OLD | NEW |