| 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 |
| 11 #include "base/allocator/allocator_extension.h" | 11 #include "base/allocator/allocator_extension.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 18 #include "base/process/process_metrics.h" | 18 #include "base/process/process_metrics.h" |
| 19 #include "base/rand_util.h" | 19 #include "base/rand_util.h" |
| 20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
| 24 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
| 25 #include "base/sys_info.h" | 25 #include "base/sys_info.h" |
| 26 #include "base/threading/platform_thread.h" | 26 #include "base/threading/platform_thread.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "blink/public/resources/grit/blink_image_resources.h" | 28 #include "blink/public/resources/grit/blink_image_resources.h" |
| 29 #include "blink/public/resources/grit/blink_resources.h" | 29 #include "blink/public/resources/grit/blink_resources.h" |
| 30 #include "components/mime_util/mime_util.h" |
| 30 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 31 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
| 31 #include "content/app/resources/grit/content_resources.h" | 32 #include "content/app/resources/grit/content_resources.h" |
| 32 #include "content/app/strings/grit/content_strings.h" | 33 #include "content/app/strings/grit/content_strings.h" |
| 33 #include "content/child/bluetooth/web_bluetooth_impl.h" | 34 #include "content/child/bluetooth/web_bluetooth_impl.h" |
| 34 #include "content/child/child_thread_impl.h" | 35 #include "content/child/child_thread_impl.h" |
| 35 #include "content/child/content_child_helpers.h" | 36 #include "content/child/content_child_helpers.h" |
| 36 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 37 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
| 37 #include "content/child/navigator_connect/navigator_connect_provider.h" | 38 #include "content/child/navigator_connect/navigator_connect_provider.h" |
| 38 #include "content/child/notifications/notification_dispatcher.h" | 39 #include "content/child/notifications/notification_dispatcher.h" |
| 39 #include "content/child/notifications/notification_manager.h" | 40 #include "content/child/notifications/notification_manager.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 } | 478 } |
| 478 | 479 |
| 479 WebString BlinkPlatformImpl::userAgent() { | 480 WebString BlinkPlatformImpl::userAgent() { |
| 480 return WebString::fromUTF8(GetContentClient()->GetUserAgent()); | 481 return WebString::fromUTF8(GetContentClient()->GetUserAgent()); |
| 481 } | 482 } |
| 482 | 483 |
| 483 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url, | 484 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url, |
| 484 WebString& mimetype_out, | 485 WebString& mimetype_out, |
| 485 WebString& charset_out) { | 486 WebString& charset_out) { |
| 486 std::string mime_type, char_set, data; | 487 std::string mime_type, char_set, data; |
| 487 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) | 488 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && |
| 488 && net::IsSupportedMimeType(mime_type)) { | 489 mime_util::IsSupportedMimeType(mime_type)) { |
| 489 mimetype_out = WebString::fromUTF8(mime_type); | 490 mimetype_out = WebString::fromUTF8(mime_type); |
| 490 charset_out = WebString::fromUTF8(char_set); | 491 charset_out = WebString::fromUTF8(char_set); |
| 491 return data; | 492 return data; |
| 492 } | 493 } |
| 493 return WebData(); | 494 return WebData(); |
| 494 } | 495 } |
| 495 | 496 |
| 496 WebURLError BlinkPlatformImpl::cancelledError( | 497 WebURLError BlinkPlatformImpl::cancelledError( |
| 497 const WebURL& unreachableURL) const { | 498 const WebURL& unreachableURL) const { |
| 498 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); | 499 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1336 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
| 1336 static_cast<ui::DomCode>(dom_code))); | 1337 static_cast<ui::DomCode>(dom_code))); |
| 1337 } | 1338 } |
| 1338 | 1339 |
| 1339 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1340 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
| 1340 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1341 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
| 1341 code.utf8().data())); | 1342 code.utf8().data())); |
| 1342 } | 1343 } |
| 1343 | 1344 |
| 1344 } // namespace content | 1345 } // namespace content |
| OLD | NEW |