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

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

Issue 14682023: Add plumbing for testing API for MockWebDeviceMotionHandler injection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: plumbing without the WebDeviceMotionProvider Created 7 years, 7 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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 21 matching lines...) Expand all
32 #include "content/renderer/media/media_stream_dependency_factory.h" 32 #include "content/renderer/media/media_stream_dependency_factory.h"
33 #include "content/renderer/media/renderer_webaudiodevice_impl.h" 33 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
34 #include "content/renderer/render_thread_impl.h" 34 #include "content/renderer/render_thread_impl.h"
35 #include "content/renderer/renderer_clipboard_client.h" 35 #include "content/renderer/renderer_clipboard_client.h"
36 #include "content/renderer/websharedworkerrepository_impl.h" 36 #include "content/renderer/websharedworkerrepository_impl.h"
37 #include "googleurl/src/gurl.h" 37 #include "googleurl/src/gurl.h"
38 #include "ipc/ipc_sync_message_filter.h" 38 #include "ipc/ipc_sync_message_filter.h"
39 #include "media/audio/audio_output_device.h" 39 #include "media/audio/audio_output_device.h"
40 #include "media/base/audio_hardware_config.h" 40 #include "media/base/audio_hardware_config.h"
41 #include "third_party/WebKit/Source/Platform/chromium/public/WebBlobRegistry.h" 41 #include "third_party/WebKit/Source/Platform/chromium/public/WebBlobRegistry.h"
42 #include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionList ener.h"
42 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h" 43 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
43 #include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h" 44 #include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
44 #include "third_party/WebKit/Source/Platform/chromium/public/WebHyphenator.h" 45 #include "third_party/WebKit/Source/Platform/chromium/public/WebHyphenator.h"
45 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente r.h" 46 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente r.h"
46 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente rClient.h" 47 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente rClient.h"
47 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 48 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
48 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" 49 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
51 #include "webkit/base/file_path_string_conversions.h" 52 #include "webkit/base/file_path_string_conversions.h"
(...skipping 23 matching lines...) Expand all
75 #include "third_party/WebKit/Source/Platform/chromium/public/linux/WebFontFamily .h" 76 #include "third_party/WebKit/Source/Platform/chromium/public/linux/WebFontFamily .h"
76 #include "third_party/WebKit/Source/Platform/chromium/public/linux/WebSandboxSup port.h" 77 #include "third_party/WebKit/Source/Platform/chromium/public/linux/WebSandboxSup port.h"
77 #endif 78 #endif
78 79
79 #if defined(OS_POSIX) 80 #if defined(OS_POSIX)
80 #include "base/file_descriptor_posix.h" 81 #include "base/file_descriptor_posix.h"
81 #endif 82 #endif
82 83
83 using WebKit::WebAudioDevice; 84 using WebKit::WebAudioDevice;
84 using WebKit::WebBlobRegistry; 85 using WebKit::WebBlobRegistry;
86 using WebKit::WebDeviceMotionListener;
85 using WebKit::WebFileInfo; 87 using WebKit::WebFileInfo;
86 using WebKit::WebFileSystem; 88 using WebKit::WebFileSystem;
87 using WebKit::WebFrame; 89 using WebKit::WebFrame;
88 using WebKit::WebGamepads; 90 using WebKit::WebGamepads;
89 using WebKit::WebIDBFactory; 91 using WebKit::WebIDBFactory;
90 using WebKit::Platform; 92 using WebKit::Platform;
91 using WebKit::WebMediaStreamCenter; 93 using WebKit::WebMediaStreamCenter;
92 using WebKit::WebMediaStreamCenterClient; 94 using WebKit::WebMediaStreamCenterClient;
93 using WebKit::WebRTCPeerConnectionHandler; 95 using WebKit::WebRTCPeerConnectionHandler;
94 using WebKit::WebRTCPeerConnectionHandlerClient; 96 using WebKit::WebRTCPeerConnectionHandlerClient;
95 using WebKit::WebStorageNamespace; 97 using WebKit::WebStorageNamespace;
96 using WebKit::WebString; 98 using WebKit::WebString;
97 using WebKit::WebURL; 99 using WebKit::WebURL;
98 using WebKit::WebVector; 100 using WebKit::WebVector;
99 101
100 namespace content { 102 namespace content {
101 103
102 static bool g_sandbox_enabled = true; 104 static bool g_sandbox_enabled = true;
103 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = 105 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
104 LAZY_INSTANCE_INITIALIZER; 106 LAZY_INSTANCE_INITIALIZER;
105 107
108 base::LazyInstance<scoped_ptr<WebDeviceMotionListener> > g_test_device_motion =
109 LAZY_INSTANCE_INITIALIZER;
110
106 //------------------------------------------------------------------------------ 111 //------------------------------------------------------------------------------
107 112
108 class RendererWebKitPlatformSupportImpl::MimeRegistry 113 class RendererWebKitPlatformSupportImpl::MimeRegistry
109 : public webkit_glue::SimpleWebMimeRegistryImpl { 114 : public webkit_glue::SimpleWebMimeRegistryImpl {
110 public: 115 public:
111 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); 116 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&);
112 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); 117 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&);
113 virtual WebKit::WebString preferredExtensionForMIMEType( 118 virtual WebKit::WebString preferredExtensionForMIMEType(
114 const WebKit::WebString&); 119 const WebKit::WebString&);
115 }; 120 };
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 shared_offscreen_context_->DestroyedOnMainThread()) { 921 shared_offscreen_context_->DestroyedOnMainThread()) {
917 shared_offscreen_context_ = 922 shared_offscreen_context_ =
918 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); 923 RenderThreadImpl::current()->OffscreenContextProviderForMainThread();
919 } 924 }
920 if (!shared_offscreen_context_) 925 if (!shared_offscreen_context_)
921 return NULL; 926 return NULL;
922 return new webkit::gpu::WebGraphicsContext3DProviderImpl( 927 return new webkit::gpu::WebGraphicsContext3DProviderImpl(
923 shared_offscreen_context_); 928 shared_offscreen_context_);
924 } 929 }
925 930
931 //------------------------------------------------------------------------------
932
933 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
934 WebKit::WebDeviceMotionListener* listener) {
935 if (g_test_device_motion.Get().get() == 0) {
936 // TODO(timvolodine) provide implementation and instantiation of the
937 // event pump.
938 } else {
939 g_test_device_motion.Get()->setListener(listener);
940 }
941 }
942
943 // static
944 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionListenerForTesting(
945 WebDeviceMotionListener* listener) {
946 g_test_device_motion.Get().reset(listener);
947 }
948
926 } // namespace content 949 } // 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