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

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

Issue 470683002: Revert "Refactor code listening to platform events in content/renderer/." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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 #ifndef CONTENT_RENDERER_RENDERER_WEBKITPLATFORMSUPPORT_IMPL_H_ 5 #ifndef CONTENT_RENDERER_RENDERER_WEBKITPLATFORMSUPPORT_IMPL_H_
6 #define CONTENT_RENDERER_RENDERER_WEBKITPLATFORMSUPPORT_IMPL_H_ 6 #define CONTENT_RENDERER_RENDERER_WEBKITPLATFORMSUPPORT_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/id_map.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
11 #include "content/child/blink_platform_impl.h" 10 #include "content/child/blink_platform_impl.h"
12 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
13 #include "content/renderer/compositor_bindings/web_compositor_support_impl.h" 12 #include "content/renderer/compositor_bindings/web_compositor_support_impl.h"
14 #include "content/renderer/webpublicsuffixlist_impl.h" 13 #include "content/renderer/webpublicsuffixlist_impl.h"
15 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
16 #include "third_party/WebKit/public/platform/WebIDBFactory.h" 15 #include "third_party/WebKit/public/platform/WebIDBFactory.h"
17 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" 16 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
18 17
19 namespace base { 18 namespace base {
(...skipping 13 matching lines...) Expand all
33 class WebDeviceMotionData; 32 class WebDeviceMotionData;
34 class WebDeviceOrientationData; 33 class WebDeviceOrientationData;
35 class WebGraphicsContext3DProvider; 34 class WebGraphicsContext3DProvider;
36 } 35 }
37 36
38 namespace content { 37 namespace content {
39 class BatteryStatusDispatcher; 38 class BatteryStatusDispatcher;
40 class DeviceLightEventPump; 39 class DeviceLightEventPump;
41 class DeviceMotionEventPump; 40 class DeviceMotionEventPump;
42 class DeviceOrientationEventPump; 41 class DeviceOrientationEventPump;
43 class PlatformEventObserverBase;
44 class QuotaMessageFilter; 42 class QuotaMessageFilter;
45 class RendererClipboardClient; 43 class RendererClipboardClient;
46 class RenderView; 44 class RenderView;
45 class RendererGamepadProvider;
47 class ThreadSafeSender; 46 class ThreadSafeSender;
48 class WebClipboardImpl; 47 class WebClipboardImpl;
49 class WebDatabaseObserverImpl; 48 class WebDatabaseObserverImpl;
50 class WebFileSystemImpl; 49 class WebFileSystemImpl;
51 50
52 class CONTENT_EXPORT RendererWebKitPlatformSupportImpl 51 class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
53 : public BlinkPlatformImpl { 52 : public BlinkPlatformImpl {
54 public: 53 public:
55 RendererWebKitPlatformSupportImpl(); 54 RendererWebKitPlatformSupportImpl();
56 virtual ~RendererWebKitPlatformSupportImpl(); 55 virtual ~RendererWebKitPlatformSupportImpl();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 virtual void startListening(blink::WebPlatformEventType, 139 virtual void startListening(blink::WebPlatformEventType,
141 blink::WebPlatformEventListener*); 140 blink::WebPlatformEventListener*);
142 virtual void stopListening(blink::WebPlatformEventType); 141 virtual void stopListening(blink::WebPlatformEventType);
143 virtual void queryStorageUsageAndQuota( 142 virtual void queryStorageUsageAndQuota(
144 const blink::WebURL& storage_partition, 143 const blink::WebURL& storage_partition,
145 blink::WebStorageQuotaType, 144 blink::WebStorageQuotaType,
146 blink::WebStorageQuotaCallbacks); 145 blink::WebStorageQuotaCallbacks);
147 virtual void vibrate(unsigned int milliseconds); 146 virtual void vibrate(unsigned int milliseconds);
148 virtual void cancelVibration(); 147 virtual void cancelVibration();
149 148
150 // Set the PlatformEventObserverBase in |platform_event_observers_| associated 149 void set_gamepad_provider(RendererGamepadProvider* provider) {
151 // with |type| to |observer|. If there was already an observer associated to 150 gamepad_provider_ = provider;
152 // the given |type|, it will be replaced. 151 }
153 // Note that |observer| will be owned by this object after the call.
154 void SetPlatformEventObserverForTesting(
155 blink::WebPlatformEventType type,
156 scoped_ptr<PlatformEventObserverBase> observer);
157 152
158 // Disables the WebSandboxSupport implementation for testing. 153 // Disables the WebSandboxSupport implementation for testing.
159 // Tests that do not set up a full sandbox environment should call 154 // Tests that do not set up a full sandbox environment should call
160 // SetSandboxEnabledForTesting(false) _before_ creating any instances 155 // SetSandboxEnabledForTesting(false) _before_ creating any instances
161 // of this class, to ensure that we don't attempt to use sandbox-related 156 // of this class, to ensure that we don't attempt to use sandbox-related
162 // file descriptors or other resources. 157 // file descriptors or other resources.
163 // 158 //
164 // Returns the previous |enable| value. 159 // Returns the previous |enable| value.
165 static bool SetSandboxEnabledForTesting(bool enable); 160 static bool SetSandboxEnabledForTesting(bool enable);
166 161
167 // Set a double to return when setDeviceLightListener is invoked. 162 // Set a double to return when setDeviceLightListener is invoked.
168 static void SetMockDeviceLightDataForTesting(double data); 163 static void SetMockDeviceLightDataForTesting(double data);
169 // Set WebDeviceMotionData to return when setDeviceMotionListener is invoked. 164 // Set WebDeviceMotionData to return when setDeviceMotionListener is invoked.
170 static void SetMockDeviceMotionDataForTesting( 165 static void SetMockDeviceMotionDataForTesting(
171 const blink::WebDeviceMotionData& data); 166 const blink::WebDeviceMotionData& data);
172 // Set WebDeviceOrientationData to return when setDeviceOrientationListener 167 // Set WebDeviceOrientationData to return when setDeviceOrientationListener
173 // is invoked. 168 // is invoked.
174 static void SetMockDeviceOrientationDataForTesting( 169 static void SetMockDeviceOrientationDataForTesting(
175 const blink::WebDeviceOrientationData& data); 170 const blink::WebDeviceOrientationData& data);
176 171
177 // Notifies blink::WebBatteryStatusListener that battery status has changed. 172 // Notifies blink::WebBatteryStatusListener that battery status has changed.
178 void MockBatteryStatusChangedForTesting( 173 static void MockBatteryStatusChangedForTesting(
179 const blink::WebBatteryStatus& status); 174 const blink::WebBatteryStatus& status);
180 175
181 WebDatabaseObserverImpl* web_database_observer_impl() { 176 WebDatabaseObserverImpl* web_database_observer_impl() {
182 return web_database_observer_impl_.get(); 177 return web_database_observer_impl_.get();
183 } 178 }
184 179
185 private: 180 private:
186 bool CheckPreparsedJsCachingEnabled() const; 181 bool CheckPreparsedJsCachingEnabled() const;
187 182
188 // Factory that takes a type and return PlatformEventObserverBase that matches 183 // Implement those methods internally so startListening() and stopListening()
189 // it. 184 // are being used and Blink can change its interface.
190 static PlatformEventObserverBase* CreatePlatformEventObserverFromType( 185 void SetDeviceMotionListener(blink::WebDeviceMotionListener*);
191 blink::WebPlatformEventType type); 186 void SetDeviceOrientationListener(blink::WebDeviceOrientationListener*);
187 void SetDeviceLightListener(blink::WebDeviceLightListener*);
188 void SetBatteryStatusListener(blink::WebBatteryStatusListener*);
189 void SetGamepadListener(blink::WebGamepadListener*);
192 190
193 // Use the data previously set via SetMockDevice...DataForTesting() and send
194 // them to the registered listener.
195 void SendFakeDeviceEventDataForTesting(blink::WebPlatformEventType type);
196 191
197 scoped_ptr<RendererClipboardClient> clipboard_client_; 192 scoped_ptr<RendererClipboardClient> clipboard_client_;
198 scoped_ptr<WebClipboardImpl> clipboard_; 193 scoped_ptr<WebClipboardImpl> clipboard_;
199 194
200 class FileUtilities; 195 class FileUtilities;
201 scoped_ptr<FileUtilities> file_utilities_; 196 scoped_ptr<FileUtilities> file_utilities_;
202 197
203 class MimeRegistry; 198 class MimeRegistry;
204 scoped_ptr<MimeRegistry> mime_registry_; 199 scoped_ptr<MimeRegistry> mime_registry_;
205 200
(...skipping 25 matching lines...) Expand all
231 scoped_refptr<QuotaMessageFilter> quota_message_filter_; 226 scoped_refptr<QuotaMessageFilter> quota_message_filter_;
232 227
233 scoped_ptr<WebDatabaseObserverImpl> web_database_observer_impl_; 228 scoped_ptr<WebDatabaseObserverImpl> web_database_observer_impl_;
234 229
235 WebCompositorSupportImpl compositor_support_; 230 WebCompositorSupportImpl compositor_support_;
236 231
237 scoped_ptr<blink::WebScrollbarBehavior> web_scrollbar_behavior_; 232 scoped_ptr<blink::WebScrollbarBehavior> web_scrollbar_behavior_;
238 233
239 scoped_ptr<BatteryStatusDispatcher> battery_status_dispatcher_; 234 scoped_ptr<BatteryStatusDispatcher> battery_status_dispatcher_;
240 235
241 IDMap<PlatformEventObserverBase, IDMapOwnPointer> platform_event_observers_; 236 RendererGamepadProvider* gamepad_provider_;
242 237
243 DISALLOW_COPY_AND_ASSIGN(RendererWebKitPlatformSupportImpl); 238 DISALLOW_COPY_AND_ASSIGN(RendererWebKitPlatformSupportImpl);
244 }; 239 };
245 240
246 } // namespace content 241 } // namespace content
247 242
248 #endif // CONTENT_RENDERER_RENDERER_WEBKITPLATFORMSUPPORT_IMPL_H_ 243 #endif // CONTENT_RENDERER_RENDERER_WEBKITPLATFORMSUPPORT_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/renderer_webkitplatformsupport_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698