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

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: remove valueIsUpdated 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/logging.h" 10 #include "base/logging.h"
(...skipping 21 matching lines...) Expand all
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/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/battery_status/fake_battery_status_dispatcher.h" 41 #include "content/renderer/battery_status/fake_battery_status_dispatcher.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"
48 #include "content/renderer/media/renderer_webaudiodevice_impl.h" 49 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
49 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" 50 #include "content/renderer/media/renderer_webmidiaccessor_impl.h"
50 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" 51 #include "content/renderer/media/webcontentdecryptionmodule_impl.h"
51 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" 52 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
52 #include "content/renderer/render_thread_impl.h" 53 #include "content/renderer/render_thread_impl.h"
53 #include "content/renderer/renderer_clipboard_client.h" 54 #include "content/renderer/renderer_clipboard_client.h"
54 #include "content/renderer/screen_orientation/mock_screen_orientation_controller .h" 55 #include "content/renderer/screen_orientation/mock_screen_orientation_controller .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/WebURL.h" 76 #include "third_party/WebKit/public/platform/WebURL.h"
75 #include "third_party/WebKit/public/platform/WebVector.h" 77 #include "third_party/WebKit/public/platform/WebVector.h"
76 #include "ui/gfx/color_profile.h" 78 #include "ui/gfx/color_profile.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 using blink::WebRTCPeerConnectionHandlerClient; 135 using blink::WebRTCPeerConnectionHandlerClient;
134 using blink::WebStorageNamespace; 136 using blink::WebStorageNamespace;
135 using blink::WebString; 137 using blink::WebString;
136 using blink::WebURL; 138 using blink::WebURL;
137 using blink::WebVector; 139 using blink::WebVector;
138 140
139 namespace content { 141 namespace content {
140 142
141 namespace { 143 namespace {
142 144
143 static bool g_sandbox_enabled = true; 145 bool g_sandbox_enabled = true;
144 static blink::WebGamepadListener* web_gamepad_listener = NULL; 146 blink::WebGamepadListener* web_gamepad_listener = NULL;
145 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = 147 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
146 LAZY_INSTANCE_INITIALIZER; 148 LAZY_INSTANCE_INITIALIZER;
149 double g_test_device_light_data = -1;
147 base::LazyInstance<blink::WebDeviceMotionData>::Leaky 150 base::LazyInstance<blink::WebDeviceMotionData>::Leaky
148 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; 151 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
149 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky 152 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky
150 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; 153 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER;
151 base::LazyInstance<MockScreenOrientationController>::Leaky 154 base::LazyInstance<MockScreenOrientationController>::Leaky
152 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; 155 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER;
153 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky 156 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky
154 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; 157 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER;
155 158
156 } // namespace 159 } // namespace
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 //------------------------------------------------------------------------------ 1045 //------------------------------------------------------------------------------
1043 1046
1044 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( 1047 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode(
1045 const blink::WebString& host, 1048 const blink::WebString& host,
1046 const blink::WebString& languages) { 1049 const blink::WebString& languages) {
1047 return net::IDNToUnicode(host.utf8(), languages.utf8()); 1050 return net::IDNToUnicode(host.utf8(), languages.utf8());
1048 } 1051 }
1049 1052
1050 //------------------------------------------------------------------------------ 1053 //------------------------------------------------------------------------------
1051 1054
1055 void RendererWebKitPlatformSupportImpl::setDeviceLightListener(
1056 blink::WebDeviceLightListener* listener) {
1057 if (g_test_device_light_data < 0) {
1058 if (!device_light_event_pump_) {
1059 device_light_event_pump_.reset(new DeviceLightEventPump);
1060 device_light_event_pump_->Attach(RenderThreadImpl::current());
1061 }
1062 device_light_event_pump_->SetListener(listener);
1063 } else if (listener) {
1064 // Testing mode: just echo the test data to the listener.
1065 base::MessageLoopProxy::current()->PostTask(
1066 FROM_HERE,
1067 base::Bind(&blink::WebDeviceLightListener::didChangeDeviceLight,
1068 base::Unretained(listener),
1069 g_test_device_light_data));
1070 }
1071 }
1072
1073 // static
1074 void RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(
1075 double data) {
1076 g_test_device_light_data = data;
1077 }
1078
1079 //------------------------------------------------------------------------------
1080
1052 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( 1081 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
1053 blink::WebDeviceMotionListener* listener) { 1082 blink::WebDeviceMotionListener* listener) {
1054 if (g_test_device_motion_data == 0) { 1083 if (g_test_device_motion_data == 0) {
1055 if (!device_motion_event_pump_) { 1084 if (!device_motion_event_pump_) {
1056 device_motion_event_pump_.reset(new DeviceMotionEventPump); 1085 device_motion_event_pump_.reset(new DeviceMotionEventPump);
1057 device_motion_event_pump_->Attach(RenderThreadImpl::current()); 1086 device_motion_event_pump_->Attach(RenderThreadImpl::current());
1058 } 1087 }
1059 device_motion_event_pump_->SetListener(listener); 1088 device_motion_event_pump_->SetListener(listener);
1060 } else if (listener) { 1089 } else if (listener) {
1061 // Testing mode: just echo the test data to the listener. 1090 // Testing mode: just echo the test data to the listener.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 battery_status_dispatcher_->SetListener(listener); 1193 battery_status_dispatcher_->SetListener(listener);
1165 } 1194 }
1166 1195
1167 // static 1196 // static
1168 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( 1197 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting(
1169 const blink::WebBatteryStatus& status) { 1198 const blink::WebBatteryStatus& status) {
1170 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); 1199 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status);
1171 } 1200 }
1172 1201
1173 } // namespace content 1202 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698