OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/renderer_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 44 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
45 #include "content/renderer/gamepad_shared_memory_reader.h" | 45 #include "content/renderer/gamepad_shared_memory_reader.h" |
46 #include "content/renderer/media/audio_decoder.h" | 46 #include "content/renderer/media/audio_decoder.h" |
47 #include "content/renderer/media/crypto/key_systems.h" | 47 #include "content/renderer/media/crypto/key_systems.h" |
48 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 48 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
49 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" | 49 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
50 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 50 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
51 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" | 51 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
52 #include "content/renderer/render_thread_impl.h" | 52 #include "content/renderer/render_thread_impl.h" |
53 #include "content/renderer/renderer_clipboard_client.h" | 53 #include "content/renderer/renderer_clipboard_client.h" |
54 #include "content/renderer/screen_orientation/mock_screen_orientation_controller
.h" | |
55 #include "content/renderer/webclipboard_impl.h" | 54 #include "content/renderer/webclipboard_impl.h" |
56 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 55 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
57 #include "content/renderer/webpublicsuffixlist_impl.h" | 56 #include "content/renderer/webpublicsuffixlist_impl.h" |
58 #include "gpu/config/gpu_info.h" | 57 #include "gpu/config/gpu_info.h" |
59 #include "ipc/ipc_sync_message_filter.h" | 58 #include "ipc/ipc_sync_message_filter.h" |
60 #include "media/audio/audio_output_device.h" | 59 #include "media/audio/audio_output_device.h" |
61 #include "media/base/audio_hardware_config.h" | 60 #include "media/base/audio_hardware_config.h" |
62 #include "media/filters/stream_parser_factory.h" | 61 #include "media/filters/stream_parser_factory.h" |
63 #include "net/base/mime_util.h" | 62 #include "net/base/mime_util.h" |
64 #include "net/base/net_util.h" | 63 #include "net/base/net_util.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 namespace { | 140 namespace { |
142 | 141 |
143 static bool g_sandbox_enabled = true; | 142 static bool g_sandbox_enabled = true; |
144 static blink::WebGamepadListener* web_gamepad_listener = NULL; | 143 static blink::WebGamepadListener* web_gamepad_listener = NULL; |
145 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = | 144 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = |
146 LAZY_INSTANCE_INITIALIZER; | 145 LAZY_INSTANCE_INITIALIZER; |
147 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 146 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
148 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 147 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
149 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 148 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
150 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 149 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
151 base::LazyInstance<MockScreenOrientationController>::Leaky | |
152 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; | |
153 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky | 150 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky |
154 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; | 151 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; |
155 | 152 |
156 } // namespace | 153 } // namespace |
157 | 154 |
158 //------------------------------------------------------------------------------ | 155 //------------------------------------------------------------------------------ |
159 | 156 |
160 class RendererWebKitPlatformSupportImpl::MimeRegistry | 157 class RendererWebKitPlatformSupportImpl::MimeRegistry |
161 : public SimpleWebMimeRegistryImpl { | 158 : public SimpleWebMimeRegistryImpl { |
162 public: | 159 public: |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 g_test_device_motion_data.Get())); | 1063 g_test_device_motion_data.Get())); |
1067 } | 1064 } |
1068 } | 1065 } |
1069 | 1066 |
1070 // static | 1067 // static |
1071 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( | 1068 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( |
1072 const blink::WebDeviceMotionData& data) { | 1069 const blink::WebDeviceMotionData& data) { |
1073 g_test_device_motion_data.Get() = data; | 1070 g_test_device_motion_data.Get() = data; |
1074 } | 1071 } |
1075 | 1072 |
1076 // static | |
1077 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting() | |
1078 { | |
1079 if (!(g_test_screen_orientation_controller == 0)) | |
1080 g_test_screen_orientation_controller.Get().ResetData(); | |
1081 } | |
1082 | |
1083 //------------------------------------------------------------------------------ | 1073 //------------------------------------------------------------------------------ |
1084 | 1074 |
1085 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( | 1075 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( |
1086 blink::WebDeviceOrientationListener* listener) { | 1076 blink::WebDeviceOrientationListener* listener) { |
1087 if (g_test_device_orientation_data == 0) { | 1077 if (g_test_device_orientation_data == 0) { |
1088 if (!device_orientation_event_pump_) { | 1078 if (!device_orientation_event_pump_) { |
1089 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); | 1079 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); |
1090 device_orientation_event_pump_->Attach(RenderThreadImpl::current()); | 1080 device_orientation_event_pump_->Attach(RenderThreadImpl::current()); |
1091 } | 1081 } |
1092 device_orientation_event_pump_->SetListener(listener); | 1082 device_orientation_event_pump_->SetListener(listener); |
(...skipping 20 matching lines...) Expand all Loading... |
1113 RenderThread::Get()->Send( | 1103 RenderThread::Get()->Send( |
1114 new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); | 1104 new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); |
1115 } | 1105 } |
1116 | 1106 |
1117 void RendererWebKitPlatformSupportImpl::cancelVibration() { | 1107 void RendererWebKitPlatformSupportImpl::cancelVibration() { |
1118 RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); | 1108 RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); |
1119 } | 1109 } |
1120 | 1110 |
1121 //------------------------------------------------------------------------------ | 1111 //------------------------------------------------------------------------------ |
1122 | 1112 |
1123 // static | |
1124 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting( | |
1125 RenderView* render_view, | |
1126 blink::WebScreenOrientationType orientation) { | |
1127 g_test_screen_orientation_controller.Get() | |
1128 .UpdateDeviceOrientation(render_view, orientation); | |
1129 } | |
1130 | |
1131 //------------------------------------------------------------------------------ | |
1132 | |
1133 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( | 1113 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( |
1134 const blink::WebURL& storage_partition, | 1114 const blink::WebURL& storage_partition, |
1135 blink::WebStorageQuotaType type, | 1115 blink::WebStorageQuotaType type, |
1136 blink::WebStorageQuotaCallbacks callbacks) { | 1116 blink::WebStorageQuotaCallbacks callbacks) { |
1137 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) | 1117 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) |
1138 return; | 1118 return; |
1139 QuotaDispatcher::ThreadSpecificInstance( | 1119 QuotaDispatcher::ThreadSpecificInstance( |
1140 thread_safe_sender_.get(), | 1120 thread_safe_sender_.get(), |
1141 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 1121 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
1142 storage_partition, | 1122 storage_partition, |
(...skipping 21 matching lines...) Expand all Loading... |
1164 battery_status_dispatcher_->SetListener(listener); | 1144 battery_status_dispatcher_->SetListener(listener); |
1165 } | 1145 } |
1166 | 1146 |
1167 // static | 1147 // static |
1168 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1148 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1169 const blink::WebBatteryStatus& status) { | 1149 const blink::WebBatteryStatus& status) { |
1170 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1150 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1171 } | 1151 } |
1172 | 1152 |
1173 } // namespace content | 1153 } // namespace content |
OLD | NEW |