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

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

Issue 5222955109842944: Add plumbing for platform based Device Motion testing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward declare of WebDeviceMotionData Created 7 years, 5 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/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/renderer/webclipboard_impl.h" 42 #include "content/renderer/webclipboard_impl.h"
43 #include "content/renderer/websharedworkerrepository_impl.h" 43 #include "content/renderer/websharedworkerrepository_impl.h"
44 #include "gpu/config/gpu_info.h" 44 #include "gpu/config/gpu_info.h"
45 #include "ipc/ipc_sync_message_filter.h" 45 #include "ipc/ipc_sync_message_filter.h"
46 #include "media/audio/audio_output_device.h" 46 #include "media/audio/audio_output_device.h"
47 #include "media/base/audio_hardware_config.h" 47 #include "media/base/audio_hardware_config.h"
48 #include "media/filters/stream_parser_factory.h" 48 #include "media/filters/stream_parser_factory.h"
49 #include "net/base/mime_util.h" 49 #include "net/base/mime_util.h"
50 #include "net/base/net_util.h" 50 #include "net/base/net_util.h"
51 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 51 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
52 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h"
52 #include "third_party/WebKit/public/platform/WebFileInfo.h" 53 #include "third_party/WebKit/public/platform/WebFileInfo.h"
53 #include "third_party/WebKit/public/platform/WebGamepads.h" 54 #include "third_party/WebKit/public/platform/WebGamepads.h"
54 #include "third_party/WebKit/public/platform/WebHyphenator.h" 55 #include "third_party/WebKit/public/platform/WebHyphenator.h"
55 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 56 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
56 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" 57 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h"
57 #include "third_party/WebKit/public/platform/WebURL.h" 58 #include "third_party/WebKit/public/platform/WebURL.h"
58 #include "third_party/WebKit/public/platform/WebVector.h" 59 #include "third_party/WebKit/public/platform/WebVector.h"
59 #include "third_party/WebKit/public/web/WebFrame.h" 60 #include "third_party/WebKit/public/web/WebFrame.h"
60 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 61 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
61 #include "url/gurl.h" 62 #include "url/gurl.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 using WebKit::WebStorageNamespace; 111 using WebKit::WebStorageNamespace;
111 using WebKit::WebString; 112 using WebKit::WebString;
112 using WebKit::WebURL; 113 using WebKit::WebURL;
113 using WebKit::WebVector; 114 using WebKit::WebVector;
114 115
115 namespace content { 116 namespace content {
116 117
117 static bool g_sandbox_enabled = true; 118 static bool g_sandbox_enabled = true;
118 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = 119 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
119 LAZY_INSTANCE_INITIALIZER; 120 LAZY_INSTANCE_INITIALIZER;
121 base::LazyInstance<WebKit::WebDeviceMotionData>::Leaky
122 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
120 123
121 //------------------------------------------------------------------------------ 124 //------------------------------------------------------------------------------
122 125
123 class RendererWebKitPlatformSupportImpl::MimeRegistry 126 class RendererWebKitPlatformSupportImpl::MimeRegistry
124 : public webkit_glue::SimpleWebMimeRegistryImpl { 127 : public webkit_glue::SimpleWebMimeRegistryImpl {
125 public: 128 public:
126 // TODO(ddorwin): Remove after http://webk.it/82983 lands. 129 // TODO(ddorwin): Remove after http://webk.it/82983 lands.
127 virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType( 130 virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
128 const WebKit::WebString& mime_type, 131 const WebKit::WebString& mime_type,
129 const WebKit::WebString& codecs); 132 const WebKit::WebString& codecs);
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 WebKit::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( 1061 WebKit::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode(
1059 const WebKit::WebString& host, 1062 const WebKit::WebString& host,
1060 const WebKit::WebString& languages) { 1063 const WebKit::WebString& languages) {
1061 return net::IDNToUnicode(host.utf8(), languages.utf8()); 1064 return net::IDNToUnicode(host.utf8(), languages.utf8());
1062 } 1065 }
1063 1066
1064 //------------------------------------------------------------------------------ 1067 //------------------------------------------------------------------------------
1065 1068
1066 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( 1069 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
1067 WebKit::WebDeviceMotionListener* listener) { 1070 WebKit::WebDeviceMotionListener* listener) {
1068 if (!device_motion_event_pump_) { 1071 if (g_test_device_motion_data == 0) {
1069 device_motion_event_pump_.reset(new DeviceMotionEventPump); 1072 if (!device_motion_event_pump_) {
1070 device_motion_event_pump_->Attach(RenderThreadImpl::current()); 1073 device_motion_event_pump_.reset(new DeviceMotionEventPump);
1074 device_motion_event_pump_->Attach(RenderThreadImpl::current());
1075 }
1076 device_motion_event_pump_->SetListener(listener);
1077 } else {
1078 base::MessageLoopProxy::current()->PostTask(
1079 FROM_HERE,
1080 base::Bind(&WebKit::WebDeviceMotionListener::didChangeDeviceMotion,
1081 base::Unretained(listener),
1082 g_test_device_motion_data.Get()));
1071 } 1083 }
1072 device_motion_event_pump_->SetListener(listener); 1084 }
1085
1086 // static
1087 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(
1088 const WebKit::WebDeviceMotionData& data) {
1089 g_test_device_motion_data.Get() = data;
1073 } 1090 }
1074 1091
1075 } // namespace content 1092 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.h ('k') | content/shell/renderer/webkit_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698