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

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

Issue 286793002: [DeviceLight] Add renderer+common parts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tim's comments Created 6 years, 6 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/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 20 matching lines...) Expand all
31 #include "content/common/gpu/client/gpu_channel_host.h" 31 #include "content/common/gpu/client/gpu_channel_host.h"
32 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 32 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
33 #include "content/common/gpu/gpu_process_launch_causes.h" 33 #include "content/common/gpu/gpu_process_launch_causes.h"
34 #include "content/common/mime_registry_messages.h" 34 #include "content/common/mime_registry_messages.h"
35 #include "content/common/screen_orientation_messages.h" 35 #include "content/common/screen_orientation_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/webplugininfo.h" 38 #include "content/public/common/webplugininfo.h"
39 #include "content/public/renderer/content_renderer_client.h" 39 #include "content/public/renderer/content_renderer_client.h"
40 #include "content/renderer/battery_status/battery_status_dispatcher.h" 40 #include "content/renderer/battery_status/battery_status_dispatcher.h"
41 #include "content/renderer/device_sensors/device_light_event_pump.h"
41 #include "content/renderer/device_sensors/device_motion_event_pump.h" 42 #include "content/renderer/device_sensors/device_motion_event_pump.h"
42 #include "content/renderer/device_sensors/device_orientation_event_pump.h" 43 #include "content/renderer/device_sensors/device_orientation_event_pump.h"
43 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 44 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
44 #include "content/renderer/gamepad_shared_memory_reader.h" 45 #include "content/renderer/gamepad_shared_memory_reader.h"
45 #include "content/renderer/media/audio_decoder.h" 46 #include "content/renderer/media/audio_decoder.h"
46 #include "content/renderer/media/crypto/key_systems.h" 47 #include "content/renderer/media/crypto/key_systems.h"
47 #include "content/renderer/media/renderer_webaudiodevice_impl.h" 48 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
48 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" 49 #include "content/renderer/media/renderer_webmidiaccessor_impl.h"
49 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" 50 #include "content/renderer/media/webcontentdecryptionmodule_impl.h"
50 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" 51 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
51 #include "content/renderer/render_thread_impl.h" 52 #include "content/renderer/render_thread_impl.h"
52 #include "content/renderer/renderer_clipboard_client.h" 53 #include "content/renderer/renderer_clipboard_client.h"
53 #include "content/renderer/screen_orientation/mock_screen_orientation_controller .h" 54 #include "content/renderer/screen_orientation/mock_screen_orientation_controller .h"
54 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" 55 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
55 #include "content/renderer/webclipboard_impl.h" 56 #include "content/renderer/webclipboard_impl.h"
56 #include "content/renderer/webgraphicscontext3d_provider_impl.h" 57 #include "content/renderer/webgraphicscontext3d_provider_impl.h"
57 #include "content/renderer/webpublicsuffixlist_impl.h" 58 #include "content/renderer/webpublicsuffixlist_impl.h"
58 #include "gpu/config/gpu_info.h" 59 #include "gpu/config/gpu_info.h"
59 #include "ipc/ipc_sync_message_filter.h" 60 #include "ipc/ipc_sync_message_filter.h"
60 #include "media/audio/audio_output_device.h" 61 #include "media/audio/audio_output_device.h"
61 #include "media/base/audio_hardware_config.h" 62 #include "media/base/audio_hardware_config.h"
62 #include "media/filters/stream_parser_factory.h" 63 #include "media/filters/stream_parser_factory.h"
63 #include "net/base/mime_util.h" 64 #include "net/base/mime_util.h"
64 #include "net/base/net_util.h" 65 #include "net/base/net_util.h"
65 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" 66 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h"
66 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 67 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
68 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
67 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" 69 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h"
68 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" 70 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h"
69 #include "third_party/WebKit/public/platform/WebFileInfo.h" 71 #include "third_party/WebKit/public/platform/WebFileInfo.h"
70 #include "third_party/WebKit/public/platform/WebGamepads.h" 72 #include "third_party/WebKit/public/platform/WebGamepads.h"
71 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 73 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
72 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" 74 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h"
73 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" 75 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
74 #include "third_party/WebKit/public/platform/WebScreenOrientationListener.h" 76 #include "third_party/WebKit/public/platform/WebScreenOrientationListener.h"
75 #include "third_party/WebKit/public/platform/WebURL.h" 77 #include "third_party/WebKit/public/platform/WebURL.h"
76 #include "third_party/WebKit/public/platform/WebVector.h" 78 #include "third_party/WebKit/public/platform/WebVector.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 using blink::WebVector; 140 using blink::WebVector;
139 141
140 namespace content { 142 namespace content {
141 143
142 namespace { 144 namespace {
143 145
144 static bool g_sandbox_enabled = true; 146 static bool g_sandbox_enabled = true;
145 static blink::WebGamepadListener* web_gamepad_listener = NULL; 147 static blink::WebGamepadListener* web_gamepad_listener = NULL;
146 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = 148 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
147 LAZY_INSTANCE_INITIALIZER; 149 LAZY_INSTANCE_INITIALIZER;
150 base::LazyInstance<double>::Leaky
timvolodine 2014/06/03 16:08:12 I wonder if LazyInstance is really needed here bec
riju_ 2014/06/05 19:50:00 Done.
151 g_test_device_light_data = LAZY_INSTANCE_INITIALIZER;
148 base::LazyInstance<blink::WebDeviceMotionData>::Leaky 152 base::LazyInstance<blink::WebDeviceMotionData>::Leaky
149 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; 153 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
150 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky 154 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky
151 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; 155 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER;
152 base::LazyInstance<MockScreenOrientationController>::Leaky 156 base::LazyInstance<MockScreenOrientationController>::Leaky
153 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; 157 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER;
154 158
155 } // namespace 159 } // namespace
156 160
157 //------------------------------------------------------------------------------ 161 //------------------------------------------------------------------------------
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 //------------------------------------------------------------------------------ 1050 //------------------------------------------------------------------------------
1047 1051
1048 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( 1052 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode(
1049 const blink::WebString& host, 1053 const blink::WebString& host,
1050 const blink::WebString& languages) { 1054 const blink::WebString& languages) {
1051 return net::IDNToUnicode(host.utf8(), languages.utf8()); 1055 return net::IDNToUnicode(host.utf8(), languages.utf8());
1052 } 1056 }
1053 1057
1054 //------------------------------------------------------------------------------ 1058 //------------------------------------------------------------------------------
1055 1059
1060 void RendererWebKitPlatformSupportImpl::setDeviceLightListener(
1061 blink::WebDeviceLightListener* listener) {
1062 if (g_test_device_light_data == 0) {
1063 if (!device_light_event_pump_) {
1064 device_light_event_pump_.reset(new DeviceLightEventPump);
1065 device_light_event_pump_->Attach(RenderThreadImpl::current());
1066 }
1067 device_light_event_pump_->SetListener(listener);
1068 } else if (listener) {
1069 // Testing mode: just echo the test data to the listener.
1070 base::MessageLoopProxy::current()->PostTask(
1071 FROM_HERE,
1072 base::Bind(&blink::WebDeviceLightListener::didChangeDeviceLight,
1073 base::Unretained(listener),
1074 g_test_device_light_data.Get()));
1075 }
1076 }
1077
1078 // static
1079 void RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(
1080 double& data) {
1081 g_test_device_light_data.Get() = data;
1082 }
1083
1084
1085 //------------------------------------------------------------------------------
1086
1056 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( 1087 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
1057 blink::WebDeviceMotionListener* listener) { 1088 blink::WebDeviceMotionListener* listener) {
1058 if (g_test_device_motion_data == 0) { 1089 if (g_test_device_motion_data == 0) {
1059 if (!device_motion_event_pump_) { 1090 if (!device_motion_event_pump_) {
1060 device_motion_event_pump_.reset(new DeviceMotionEventPump); 1091 device_motion_event_pump_.reset(new DeviceMotionEventPump);
1061 device_motion_event_pump_->Attach(RenderThreadImpl::current()); 1092 device_motion_event_pump_->Attach(RenderThreadImpl::current());
1062 } 1093 }
1063 device_motion_event_pump_->SetListener(listener); 1094 device_motion_event_pump_->SetListener(listener);
1064 } else if (listener) { 1095 } else if (listener) {
1065 // Testing mode: just echo the test data to the listener. 1096 // Testing mode: just echo the test data to the listener.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener( 1221 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener(
1191 blink::WebBatteryStatusListener* listener) { 1222 blink::WebBatteryStatusListener* listener) {
1192 if (!battery_status_dispatcher_) { 1223 if (!battery_status_dispatcher_) {
1193 battery_status_dispatcher_.reset( 1224 battery_status_dispatcher_.reset(
1194 new BatteryStatusDispatcher(RenderThreadImpl::current())); 1225 new BatteryStatusDispatcher(RenderThreadImpl::current()));
1195 } 1226 }
1196 battery_status_dispatcher_->SetListener(listener); 1227 battery_status_dispatcher_->SetListener(listener);
1197 } 1228 }
1198 1229
1199 } // namespace content 1230 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698