Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 583663003: Vibration API : migrate to device/vibration using mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gn builds Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1035
1035 // static 1036 // static
1036 void RendererWebKitPlatformSupportImpl::SetMockDeviceOrientationDataForTesting( 1037 void RendererWebKitPlatformSupportImpl::SetMockDeviceOrientationDataForTesting(
1037 const blink::WebDeviceOrientationData& data) { 1038 const blink::WebDeviceOrientationData& data) {
1038 g_test_device_orientation_data.Get() = data; 1039 g_test_device_orientation_data.Get() = data;
1039 } 1040 }
1040 1041
1041 //------------------------------------------------------------------------------ 1042 //------------------------------------------------------------------------------
1042 1043
1043 void RendererWebKitPlatformSupportImpl::vibrate(unsigned int milliseconds) { 1044 void RendererWebKitPlatformSupportImpl::vibrate(unsigned int milliseconds) {
1044 RenderThread::Get()->Send( 1045 GetConnectedVibrationManagerService()->Vibrate(
1045 new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); 1046 base::checked_cast<int64>(milliseconds));
1046 } 1047 }
1047 1048
1048 void RendererWebKitPlatformSupportImpl::cancelVibration() { 1049 void RendererWebKitPlatformSupportImpl::cancelVibration() {
1049 RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); 1050 GetConnectedVibrationManagerService()->Cancel();
1051 }
1052
1053 device::VibrationManagerPtr&
1054 RendererWebKitPlatformSupportImpl::GetConnectedVibrationManagerService() {
1055 if (!vibration_manager_) {
1056 RenderThread::Get()->GetServiceRegistry()
1057 ->ConnectToRemoteService(&vibration_manager_);
1058 }
1059 return vibration_manager_;
1050 } 1060 }
1051 1061
1052 //------------------------------------------------------------------------------ 1062 //------------------------------------------------------------------------------
1053 1063
1054 // static 1064 // static
1055 PlatformEventObserverBase* 1065 PlatformEventObserverBase*
1056 RendererWebKitPlatformSupportImpl::CreatePlatformEventObserverFromType( 1066 RendererWebKitPlatformSupportImpl::CreatePlatformEventObserverFromType(
1057 blink::WebPlatformEventType type) { 1067 blink::WebPlatformEventType type) {
1058 RenderThread* thread = RenderThreadImpl::current(); 1068 RenderThread* thread = RenderThreadImpl::current();
1059 1069
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( 1197 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting(
1188 const blink::WebBatteryStatus& status) { 1198 const blink::WebBatteryStatus& status) {
1189 PlatformEventObserverBase* observer = 1199 PlatformEventObserverBase* observer =
1190 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); 1200 platform_event_observers_.Lookup(blink::WebPlatformEventBattery);
1191 if (!observer) 1201 if (!observer)
1192 return; 1202 return;
1193 observer->SendFakeDataForTesting((void*)&status); 1203 observer->SendFakeDataForTesting((void*)&status);
1194 } 1204 }
1195 1205
1196 } // namespace content 1206 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698