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

Side by Side Diff: content/renderer/renderer_blink_platform_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: hide default service implementation, fix android_aosp Created 6 years 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
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.h ('k') | device/vibration/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_blink_platform_impl.h" 5 #include "content/renderer/renderer_blink_platform_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/renderer_webaudiodevice_impl.h" 48 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1048
1048 // static 1049 // static
1049 void RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting( 1050 void RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(
1050 const blink::WebDeviceOrientationData& data) { 1051 const blink::WebDeviceOrientationData& data) {
1051 g_test_device_orientation_data.Get() = data; 1052 g_test_device_orientation_data.Get() = data;
1052 } 1053 }
1053 1054
1054 //------------------------------------------------------------------------------ 1055 //------------------------------------------------------------------------------
1055 1056
1056 void RendererBlinkPlatformImpl::vibrate(unsigned int milliseconds) { 1057 void RendererBlinkPlatformImpl::vibrate(unsigned int milliseconds) {
1057 RenderThread::Get()->Send( 1058 GetConnectedVibrationManagerService()->Vibrate(
1058 new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); 1059 base::checked_cast<int64>(milliseconds));
1059 } 1060 }
1060 1061
1061 void RendererBlinkPlatformImpl::cancelVibration() { 1062 void RendererBlinkPlatformImpl::cancelVibration() {
1062 RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); 1063 GetConnectedVibrationManagerService()->Cancel();
1064 }
1065
1066 device::VibrationManagerPtr&
1067 RendererBlinkPlatformImpl::GetConnectedVibrationManagerService() {
1068 if (!vibration_manager_) {
1069 RenderThread::Get()->GetServiceRegistry()
1070 ->ConnectToRemoteService(&vibration_manager_);
1071 }
1072 return vibration_manager_;
1063 } 1073 }
1064 1074
1065 //------------------------------------------------------------------------------ 1075 //------------------------------------------------------------------------------
1066 1076
1067 // static 1077 // static
1068 PlatformEventObserverBase* 1078 PlatformEventObserverBase*
1069 RendererBlinkPlatformImpl::CreatePlatformEventObserverFromType( 1079 RendererBlinkPlatformImpl::CreatePlatformEventObserverFromType(
1070 blink::WebPlatformEventType type) { 1080 blink::WebPlatformEventType type) {
1071 RenderThread* thread = RenderThreadImpl::current(); 1081 RenderThread* thread = RenderThreadImpl::current();
1072 1082
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 //------------------------------------------------------------------------------ 1221 //------------------------------------------------------------------------------
1212 1222
1213 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( 1223 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting(
1214 const blink::WebBatteryStatus& status) { 1224 const blink::WebBatteryStatus& status) {
1215 if (!g_test_battery_status_listener) 1225 if (!g_test_battery_status_listener)
1216 return; 1226 return;
1217 g_test_battery_status_listener->updateBatteryStatus(status); 1227 g_test_battery_status_listener->updateBatteryStatus(status);
1218 } 1228 }
1219 1229
1220 } // namespace content 1230 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.h ('k') | device/vibration/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698