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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 137 |
139 namespace content { | 138 namespace content { |
140 | 139 |
141 namespace { | 140 namespace { |
142 | 141 |
143 static bool g_sandbox_enabled = true; | 142 static bool g_sandbox_enabled = true; |
144 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 143 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
145 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 144 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
146 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 145 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
147 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 146 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
148 base::LazyInstance<MockScreenOrientationController>::Leaky | |
149 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; | |
150 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky | 147 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky |
151 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; | 148 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; |
152 | 149 |
153 } // namespace | 150 } // namespace |
154 | 151 |
155 //------------------------------------------------------------------------------ | 152 //------------------------------------------------------------------------------ |
156 | 153 |
157 class RendererWebKitPlatformSupportImpl::MimeRegistry | 154 class RendererWebKitPlatformSupportImpl::MimeRegistry |
158 : public SimpleWebMimeRegistryImpl { | 155 : public SimpleWebMimeRegistryImpl { |
159 public: | 156 public: |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 g_test_device_motion_data.Get())); | 1035 g_test_device_motion_data.Get())); |
1039 } | 1036 } |
1040 } | 1037 } |
1041 | 1038 |
1042 // static | 1039 // static |
1043 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( | 1040 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( |
1044 const blink::WebDeviceMotionData& data) { | 1041 const blink::WebDeviceMotionData& data) { |
1045 g_test_device_motion_data.Get() = data; | 1042 g_test_device_motion_data.Get() = data; |
1046 } | 1043 } |
1047 | 1044 |
1048 // static | |
1049 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting() | |
1050 { | |
1051 if (!(g_test_screen_orientation_controller == 0)) | |
1052 g_test_screen_orientation_controller.Get().ResetData(); | |
1053 } | |
1054 | |
1055 //------------------------------------------------------------------------------ | 1045 //------------------------------------------------------------------------------ |
1056 | 1046 |
1057 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( | 1047 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( |
1058 blink::WebDeviceOrientationListener* listener) { | 1048 blink::WebDeviceOrientationListener* listener) { |
1059 if (g_test_device_orientation_data == 0) { | 1049 if (g_test_device_orientation_data == 0) { |
1060 if (!device_orientation_event_pump_) { | 1050 if (!device_orientation_event_pump_) { |
1061 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); | 1051 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); |
1062 device_orientation_event_pump_->Attach(RenderThreadImpl::current()); | 1052 device_orientation_event_pump_->Attach(RenderThreadImpl::current()); |
1063 } | 1053 } |
1064 device_orientation_event_pump_->SetListener(listener); | 1054 device_orientation_event_pump_->SetListener(listener); |
(...skipping 20 matching lines...) Expand all Loading... |
1085 RenderThread::Get()->Send( | 1075 RenderThread::Get()->Send( |
1086 new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); | 1076 new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); |
1087 } | 1077 } |
1088 | 1078 |
1089 void RendererWebKitPlatformSupportImpl::cancelVibration() { | 1079 void RendererWebKitPlatformSupportImpl::cancelVibration() { |
1090 RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); | 1080 RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); |
1091 } | 1081 } |
1092 | 1082 |
1093 //------------------------------------------------------------------------------ | 1083 //------------------------------------------------------------------------------ |
1094 | 1084 |
1095 // static | |
1096 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting( | |
1097 RenderView* render_view, | |
1098 blink::WebScreenOrientationType orientation) { | |
1099 g_test_screen_orientation_controller.Get() | |
1100 .UpdateDeviceOrientation(render_view, orientation); | |
1101 } | |
1102 | |
1103 //------------------------------------------------------------------------------ | |
1104 | |
1105 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( | 1085 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( |
1106 const blink::WebURL& storage_partition, | 1086 const blink::WebURL& storage_partition, |
1107 blink::WebStorageQuotaType type, | 1087 blink::WebStorageQuotaType type, |
1108 blink::WebStorageQuotaCallbacks callbacks) { | 1088 blink::WebStorageQuotaCallbacks callbacks) { |
1109 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) | 1089 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) |
1110 return; | 1090 return; |
1111 QuotaDispatcher::ThreadSpecificInstance( | 1091 QuotaDispatcher::ThreadSpecificInstance( |
1112 thread_safe_sender_.get(), | 1092 thread_safe_sender_.get(), |
1113 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 1093 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
1114 storage_partition, | 1094 storage_partition, |
(...skipping 21 matching lines...) Expand all Loading... |
1136 battery_status_dispatcher_->SetListener(listener); | 1116 battery_status_dispatcher_->SetListener(listener); |
1137 } | 1117 } |
1138 | 1118 |
1139 // static | 1119 // static |
1140 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1120 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1141 const blink::WebBatteryStatus& status) { | 1121 const blink::WebBatteryStatus& status) { |
1142 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1122 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1143 } | 1123 } |
1144 | 1124 |
1145 } // namespace content | 1125 } // namespace content |
OLD | NEW |