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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "base/trace_event/memory_dump_manager.h" | 32 #include "base/trace_event/memory_dump_manager.h" |
33 #include "base/trace_event/trace_event.h" | 33 #include "base/trace_event/trace_event.h" |
34 #include "blink/public/resources/grit/blink_image_resources.h" | 34 #include "blink/public/resources/grit/blink_image_resources.h" |
35 #include "blink/public/resources/grit/blink_resources.h" | 35 #include "blink/public/resources/grit/blink_resources.h" |
36 #include "components/mime_util/mime_util.h" | 36 #include "components/mime_util/mime_util.h" |
37 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 37 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
38 #include "content/app/resources/grit/content_resources.h" | 38 #include "content/app/resources/grit/content_resources.h" |
39 #include "content/app/strings/grit/content_strings.h" | 39 #include "content/app/strings/grit/content_strings.h" |
40 #include "content/child/background_sync/background_sync_provider.h" | 40 #include "content/child/background_sync/background_sync_provider.h" |
41 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" | 41 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" |
42 #include "content/child/bluetooth/web_bluetooth_impl.h" | |
43 #include "content/child/child_thread_impl.h" | 42 #include "content/child/child_thread_impl.h" |
44 #include "content/child/content_child_helpers.h" | 43 #include "content/child/content_child_helpers.h" |
45 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 44 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
46 #include "content/child/navigator_connect/service_port_provider.h" | 45 #include "content/child/navigator_connect/service_port_provider.h" |
47 #include "content/child/notifications/notification_dispatcher.h" | 46 #include "content/child/notifications/notification_dispatcher.h" |
48 #include "content/child/notifications/notification_manager.h" | 47 #include "content/child/notifications/notification_manager.h" |
49 #include "content/child/permissions/permission_dispatcher.h" | 48 #include "content/child/permissions/permission_dispatcher.h" |
50 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
51 #include "content/child/push_messaging/push_dispatcher.h" | 50 #include "content/child/push_messaging/push_dispatcher.h" |
52 #include "content/child/push_messaging/push_provider.h" | 51 #include "content/child/push_messaging/push_provider.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) | 446 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) |
448 : main_thread_task_runner_(main_thread_task_runner) { | 447 : main_thread_task_runner_(main_thread_task_runner) { |
449 InternalInit(); | 448 InternalInit(); |
450 } | 449 } |
451 | 450 |
452 void BlinkPlatformImpl::InternalInit() { | 451 void BlinkPlatformImpl::InternalInit() { |
453 // ChildThread may not exist in some tests. | 452 // ChildThread may not exist in some tests. |
454 if (ChildThreadImpl::current()) { | 453 if (ChildThreadImpl::current()) { |
455 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 454 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
456 ChildThreadImpl::current()->thread_safe_sender())); | 455 ChildThreadImpl::current()->thread_safe_sender())); |
457 bluetooth_.reset( | |
458 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); | |
459 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 456 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
460 notification_dispatcher_ = | 457 notification_dispatcher_ = |
461 ChildThreadImpl::current()->notification_dispatcher(); | 458 ChildThreadImpl::current()->notification_dispatcher(); |
462 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 459 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
463 permission_client_.reset(new PermissionDispatcher( | 460 permission_client_.reset(new PermissionDispatcher( |
464 ChildThreadImpl::current()->service_registry())); | 461 ChildThreadImpl::current()->service_registry())); |
465 sync_provider_.reset(new BackgroundSyncProvider( | 462 sync_provider_.reset(new BackgroundSyncProvider( |
466 ChildThreadImpl::current()->service_registry())); | 463 ChildThreadImpl::current()->service_registry())); |
467 } | 464 } |
468 } | 465 } |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 } | 1165 } |
1169 | 1166 |
1170 blink::WebCrypto* BlinkPlatformImpl::crypto() { | 1167 blink::WebCrypto* BlinkPlatformImpl::crypto() { |
1171 return &web_crypto_; | 1168 return &web_crypto_; |
1172 } | 1169 } |
1173 | 1170 |
1174 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { | 1171 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { |
1175 return geofencing_provider_.get(); | 1172 return geofencing_provider_.get(); |
1176 } | 1173 } |
1177 | 1174 |
1178 blink::WebBluetooth* BlinkPlatformImpl::bluetooth() { | |
1179 return bluetooth_.get(); | |
1180 } | |
1181 | |
1182 blink::WebNotificationManager* | 1175 blink::WebNotificationManager* |
1183 BlinkPlatformImpl::notificationManager() { | 1176 BlinkPlatformImpl::notificationManager() { |
1184 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) | 1177 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) |
1185 return nullptr; | 1178 return nullptr; |
1186 | 1179 |
1187 return NotificationManager::ThreadSpecificInstance( | 1180 return NotificationManager::ThreadSpecificInstance( |
1188 thread_safe_sender_.get(), | 1181 thread_safe_sender_.get(), |
1189 main_thread_task_runner_.get(), | 1182 main_thread_task_runner_.get(), |
1190 notification_dispatcher_.get()); | 1183 notification_dispatcher_.get()); |
1191 } | 1184 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1373 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
1381 static_cast<ui::DomCode>(dom_code))); | 1374 static_cast<ui::DomCode>(dom_code))); |
1382 } | 1375 } |
1383 | 1376 |
1384 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1377 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
1385 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1378 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
1386 code.utf8().data())); | 1379 code.utf8().data())); |
1387 } | 1380 } |
1388 | 1381 |
1389 } // namespace content | 1382 } // namespace content |
OLD | NEW |