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 <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "blink/public/resources/grit/blink_resources.h" | 35 #include "blink/public/resources/grit/blink_resources.h" |
36 #include "build/build_config.h" | 36 #include "build/build_config.h" |
37 #include "components/mime_util/mime_util.h" | 37 #include "components/mime_util/mime_util.h" |
38 #include "components/scheduler/child/web_task_runner_impl.h" | 38 #include "components/scheduler/child/web_task_runner_impl.h" |
39 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 39 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
40 #include "content/app/resources/grit/content_resources.h" | 40 #include "content/app/resources/grit/content_resources.h" |
41 #include "content/app/strings/grit/content_strings.h" | 41 #include "content/app/strings/grit/content_strings.h" |
42 #include "content/child/background_sync/background_sync_provider.h" | 42 #include "content/child/background_sync/background_sync_provider.h" |
43 #include "content/child/child_thread_impl.h" | 43 #include "content/child/child_thread_impl.h" |
44 #include "content/child/content_child_helpers.h" | 44 #include "content/child/content_child_helpers.h" |
45 #include "content/child/geofencing/web_geofencing_provider_impl.h" | |
46 #include "content/child/notifications/notification_dispatcher.h" | 45 #include "content/child/notifications/notification_dispatcher.h" |
47 #include "content/child/notifications/notification_manager.h" | 46 #include "content/child/notifications/notification_manager.h" |
48 #include "content/child/permissions/permission_dispatcher.h" | 47 #include "content/child/permissions/permission_dispatcher.h" |
49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 48 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
50 #include "content/child/push_messaging/push_dispatcher.h" | 49 #include "content/child/push_messaging/push_dispatcher.h" |
51 #include "content/child/push_messaging/push_provider.h" | 50 #include "content/child/push_messaging/push_provider.h" |
52 #include "content/child/thread_safe_sender.h" | 51 #include "content/child/thread_safe_sender.h" |
53 #include "content/child/web_url_loader_impl.h" | 52 #include "content/child/web_url_loader_impl.h" |
54 #include "content/child/web_url_request_util.h" | 53 #include "content/child/web_url_request_util.h" |
55 #include "content/child/websocket_bridge.h" | 54 #include "content/child/websocket_bridge.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 BlinkPlatformImpl::BlinkPlatformImpl( | 376 BlinkPlatformImpl::BlinkPlatformImpl( |
378 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) | 377 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) |
379 : main_thread_task_runner_(main_thread_task_runner), | 378 : main_thread_task_runner_(main_thread_task_runner), |
380 compositor_thread_(nullptr) { | 379 compositor_thread_(nullptr) { |
381 InternalInit(); | 380 InternalInit(); |
382 } | 381 } |
383 | 382 |
384 void BlinkPlatformImpl::InternalInit() { | 383 void BlinkPlatformImpl::InternalInit() { |
385 // ChildThread may not exist in some tests. | 384 // ChildThread may not exist in some tests. |
386 if (ChildThreadImpl::current()) { | 385 if (ChildThreadImpl::current()) { |
387 geofencing_provider_.reset(new WebGeofencingProviderImpl( | |
388 ChildThreadImpl::current()->thread_safe_sender())); | |
389 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 386 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
390 notification_dispatcher_ = | 387 notification_dispatcher_ = |
391 ChildThreadImpl::current()->notification_dispatcher(); | 388 ChildThreadImpl::current()->notification_dispatcher(); |
392 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 389 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
393 permission_client_.reset(new PermissionDispatcher( | 390 permission_client_.reset(new PermissionDispatcher( |
394 ChildThreadImpl::current()->service_registry())); | 391 ChildThreadImpl::current()->service_registry())); |
395 main_thread_sync_provider_.reset( | 392 main_thread_sync_provider_.reset( |
396 new BackgroundSyncProvider(main_thread_task_runner_.get())); | 393 new BackgroundSyncProvider(main_thread_task_runner_.get())); |
397 } | 394 } |
398 } | 395 } |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 852 } |
856 | 853 |
857 void BlinkPlatformImpl::willStopWorkerThread() { | 854 void BlinkPlatformImpl::willStopWorkerThread() { |
858 WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); | 855 WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); |
859 } | 856 } |
860 | 857 |
861 blink::WebCrypto* BlinkPlatformImpl::crypto() { | 858 blink::WebCrypto* BlinkPlatformImpl::crypto() { |
862 return &web_crypto_; | 859 return &web_crypto_; |
863 } | 860 } |
864 | 861 |
865 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { | |
866 return geofencing_provider_.get(); | |
867 } | |
868 | |
869 blink::WebNotificationManager* | 862 blink::WebNotificationManager* |
870 BlinkPlatformImpl::notificationManager() { | 863 BlinkPlatformImpl::notificationManager() { |
871 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) | 864 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) |
872 return nullptr; | 865 return nullptr; |
873 | 866 |
874 return NotificationManager::ThreadSpecificInstance( | 867 return NotificationManager::ThreadSpecificInstance( |
875 thread_safe_sender_.get(), | 868 thread_safe_sender_.get(), |
876 notification_dispatcher_.get()); | 869 notification_dispatcher_.get()); |
877 } | 870 } |
878 | 871 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 999 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
1007 static_cast<ui::DomKey>(dom_key))); | 1000 static_cast<ui::DomKey>(dom_key))); |
1008 } | 1001 } |
1009 | 1002 |
1010 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1003 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
1011 return static_cast<int>( | 1004 return static_cast<int>( |
1012 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1005 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
1013 } | 1006 } |
1014 | 1007 |
1015 } // namespace content | 1008 } // namespace content |
OLD | NEW |