Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 #include "content/child/webfileutilities_impl.h" | 28 #include "content/child/webfileutilities_impl.h" |
| 29 #include "content/child/webmessageportchannel_impl.h" | 29 #include "content/child/webmessageportchannel_impl.h" |
| 30 #include "content/common/file_utilities_messages.h" | 30 #include "content/common/file_utilities_messages.h" |
| 31 #include "content/common/gpu/client/context_provider_command_buffer.h" | 31 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 32 #include "content/common/gpu/client/gpu_channel_host.h" | 32 #include "content/common/gpu/client/gpu_channel_host.h" |
| 33 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 33 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 34 #include "content/common/gpu/gpu_process_launch_causes.h" | 34 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 35 #include "content/common/mime_registry_messages.h" | 35 #include "content/common/mime_registry_messages.h" |
| 36 #include "content/common/view_messages.h" | 36 #include "content/common/view_messages.h" |
| 37 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 38 #include "content/public/common/service_registry.h" | |
| 38 #include "content/public/common/webplugininfo.h" | 39 #include "content/public/common/webplugininfo.h" |
| 39 #include "content/public/renderer/content_renderer_client.h" | 40 #include "content/public/renderer/content_renderer_client.h" |
| 40 #include "content/renderer/battery_status/battery_status_dispatcher.h" | 41 #include "content/renderer/battery_status/battery_status_dispatcher.h" |
| 41 #include "content/renderer/device_sensors/device_light_event_pump.h" | 42 #include "content/renderer/device_sensors/device_light_event_pump.h" |
| 42 #include "content/renderer/device_sensors/device_motion_event_pump.h" | 43 #include "content/renderer/device_sensors/device_motion_event_pump.h" |
| 43 #include "content/renderer/device_sensors/device_orientation_event_pump.h" | 44 #include "content/renderer/device_sensors/device_orientation_event_pump.h" |
| 44 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 45 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 45 #include "content/renderer/gamepad_shared_memory_reader.h" | 46 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 46 #include "content/renderer/media/audio_decoder.h" | 47 #include "content/renderer/media/audio_decoder.h" |
| 47 #include "content/renderer/media/crypto/key_systems.h" | 48 #include "content/renderer/media/crypto/key_systems.h" |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1029 | 1030 |
| 1030 // static | 1031 // static |
| 1031 void RendererWebKitPlatformSupportImpl::SetMockDeviceOrientationDataForTesting( | 1032 void RendererWebKitPlatformSupportImpl::SetMockDeviceOrientationDataForTesting( |
| 1032 const blink::WebDeviceOrientationData& data) { | 1033 const blink::WebDeviceOrientationData& data) { |
| 1033 g_test_device_orientation_data.Get() = data; | 1034 g_test_device_orientation_data.Get() = data; |
| 1034 } | 1035 } |
| 1035 | 1036 |
| 1036 //------------------------------------------------------------------------------ | 1037 //------------------------------------------------------------------------------ |
| 1037 | 1038 |
| 1038 void RendererWebKitPlatformSupportImpl::vibrate(unsigned int milliseconds) { | 1039 void RendererWebKitPlatformSupportImpl::vibrate(unsigned int milliseconds) { |
| 1039 RenderThread::Get()->Send( | 1040 if (!vibration_manager_) { |
| 1040 new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); | 1041 RenderThread::Get()->GetServiceRegistry() |
| 1042 ->ConnectToRemoteService(&vibration_manager_); | |
| 1043 } | |
| 1044 vibration_manager_->Vibrate(milliseconds); | |
|
Michael van Ouwerkerk
2014/09/29 12:55:19
Why did you omit the cast?
timvolodine
2014/10/03 15:57:14
I've put it back. Done.
| |
| 1041 } | 1045 } |
| 1042 | 1046 |
| 1043 void RendererWebKitPlatformSupportImpl::cancelVibration() { | 1047 void RendererWebKitPlatformSupportImpl::cancelVibration() { |
| 1044 RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); | 1048 if (vibration_manager_) |
|
Michael van Ouwerkerk
2014/09/29 12:55:19
Why isn't one instantiated when needed? A vibratio
timvolodine
2014/10/03 15:57:14
good point. Done.
| |
| 1049 vibration_manager_->Cancel(); | |
| 1045 } | 1050 } |
| 1046 | 1051 |
| 1047 //------------------------------------------------------------------------------ | 1052 //------------------------------------------------------------------------------ |
| 1048 | 1053 |
| 1049 // static | 1054 // static |
| 1050 PlatformEventObserverBase* | 1055 PlatformEventObserverBase* |
| 1051 RendererWebKitPlatformSupportImpl::CreatePlatformEventObserverFromType( | 1056 RendererWebKitPlatformSupportImpl::CreatePlatformEventObserverFromType( |
| 1052 blink::WebPlatformEventType type) { | 1057 blink::WebPlatformEventType type) { |
| 1053 RenderThread* thread = RenderThreadImpl::current(); | 1058 RenderThread* thread = RenderThreadImpl::current(); |
| 1054 | 1059 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1182 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1187 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
| 1183 const blink::WebBatteryStatus& status) { | 1188 const blink::WebBatteryStatus& status) { |
| 1184 PlatformEventObserverBase* observer = | 1189 PlatformEventObserverBase* observer = |
| 1185 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); | 1190 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); |
| 1186 if (!observer) | 1191 if (!observer) |
| 1187 return; | 1192 return; |
| 1188 observer->SendFakeDataForTesting((void*)&status); | 1193 observer->SendFakeDataForTesting((void*)&status); |
| 1189 } | 1194 } |
| 1190 | 1195 |
| 1191 } // namespace content | 1196 } // namespace content |
| OLD | NEW |