OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 18 matching lines...) Expand all Loading... | |
29 */ | 29 */ |
30 | 30 |
31 #ifndef Platform_h | 31 #ifndef Platform_h |
32 #define Platform_h | 32 #define Platform_h |
33 | 33 |
34 #ifdef WIN32 | 34 #ifdef WIN32 |
35 #include <windows.h> | 35 #include <windows.h> |
36 #endif | 36 #endif |
37 | 37 |
38 #include "WebAudioDevice.h" | 38 #include "WebAudioDevice.h" |
39 #include "WebBatteryStatusListener.h" | |
39 #include "WebCommon.h" | 40 #include "WebCommon.h" |
40 #include "WebData.h" | 41 #include "WebData.h" |
42 #include "WebDeviceLightListener.h" | |
43 #include "WebDeviceMotionListener.h" | |
44 #include "WebDeviceOrientationListener.h" | |
41 #include "WebGamepadListener.h" | 45 #include "WebGamepadListener.h" |
42 #include "WebGamepads.h" | 46 #include "WebGamepads.h" |
43 #include "WebGestureDevice.h" | 47 #include "WebGestureDevice.h" |
44 #include "WebGraphicsContext3D.h" | 48 #include "WebGraphicsContext3D.h" |
45 #include "WebLocalizedString.h" | 49 #include "WebLocalizedString.h" |
46 #include "WebLockOrientationCallback.h" | 50 #include "WebPlatformEventType.h" |
47 #include "WebSpeechSynthesizer.h" | 51 #include "WebSpeechSynthesizer.h" |
48 #include "WebStorageQuotaCallbacks.h" | 52 #include "WebStorageQuotaCallbacks.h" |
49 #include "WebStorageQuotaType.h" | 53 #include "WebStorageQuotaType.h" |
50 #include "WebString.h" | 54 #include "WebString.h" |
51 #include "WebURLError.h" | 55 #include "WebURLError.h" |
52 #include "WebVector.h" | 56 #include "WebVector.h" |
53 | 57 |
54 class GrContext; | 58 class GrContext; |
55 | 59 |
56 namespace blink { | 60 namespace blink { |
57 | 61 |
58 class WebAudioBus; | 62 class WebAudioBus; |
59 class WebBatteryStatusListener; | |
60 class WebBlobRegistry; | 63 class WebBlobRegistry; |
61 class WebContentDecryptionModule; | 64 class WebContentDecryptionModule; |
62 class WebClipboard; | 65 class WebClipboard; |
63 class WebCompositorSupport; | 66 class WebCompositorSupport; |
64 class WebConvertableToTraceFormat; | 67 class WebConvertableToTraceFormat; |
65 class WebCookieJar; | 68 class WebCookieJar; |
66 class WebCrypto; | 69 class WebCrypto; |
67 class WebDatabaseObserver; | 70 class WebDatabaseObserver; |
68 class WebDeviceLightListener; | |
69 class WebDeviceMotionListener; | |
70 class WebDeviceOrientationListener; | |
71 class WebDiscardableMemory; | 71 class WebDiscardableMemory; |
72 class WebPlatformEventListener; | |
72 class WebFallbackThemeEngine; | 73 class WebFallbackThemeEngine; |
73 class WebFileSystem; | 74 class WebFileSystem; |
74 class WebFileUtilities; | 75 class WebFileUtilities; |
75 class WebFlingAnimator; | 76 class WebFlingAnimator; |
76 class WebGestureCurveTarget; | 77 class WebGestureCurveTarget; |
77 class WebGestureCurve; | 78 class WebGestureCurve; |
78 class WebGraphicsContext3DProvider; | 79 class WebGraphicsContext3DProvider; |
79 class WebIDBFactory; | 80 class WebIDBFactory; |
80 class WebMIDIAccessor; | 81 class WebMIDIAccessor; |
81 class WebMIDIAccessorClient; | 82 class WebMIDIAccessorClient; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned number OfInputChannels, unsigned numberOfChannels, double sampleRate, WebAudioDevice::R enderCallback*, const WebString& deviceId) { return 0; } | 157 virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned number OfInputChannels, unsigned numberOfChannels, double sampleRate, WebAudioDevice::R enderCallback*, const WebString& deviceId) { return 0; } |
157 | 158 |
158 | 159 |
159 // MIDI ---------------------------------------------------------------- | 160 // MIDI ---------------------------------------------------------------- |
160 | 161 |
161 // Creates a platform dependent WebMIDIAccessor. MIDIAccessor under platform | 162 // Creates a platform dependent WebMIDIAccessor. MIDIAccessor under platform |
162 // creates and owns it. | 163 // creates and owns it. |
163 virtual WebMIDIAccessor* createMIDIAccessor(WebMIDIAccessorClient*) { return 0; } | 164 virtual WebMIDIAccessor* createMIDIAccessor(WebMIDIAccessorClient*) { return 0; } |
164 | 165 |
165 | 166 |
166 // Battery ------------------------------------------------------------- | |
167 | |
168 // Sets the listener for watching battery status updates. | |
169 virtual void setBatteryStatusListener(blink::WebBatteryStatusListener*) { } | |
170 | |
171 | |
172 // Blob ---------------------------------------------------------------- | 167 // Blob ---------------------------------------------------------------- |
173 | 168 |
174 // Must return non-null. | 169 // Must return non-null. |
175 virtual WebBlobRegistry* blobRegistry() { return 0; } | 170 virtual WebBlobRegistry* blobRegistry() { return 0; } |
176 | 171 |
177 | 172 |
178 // Database ------------------------------------------------------------ | 173 // Database ------------------------------------------------------------ |
179 | 174 |
180 // Opens a database file; dirHandle should be 0 if the caller does not need | 175 // Opens a database file; dirHandle should be 0 if the caller does not need |
181 // a handle to the directory containing this file | 176 // a handle to the directory containing this file |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 // IndexedDB ---------------------------------------------------------- | 209 // IndexedDB ---------------------------------------------------------- |
215 | 210 |
216 // Must return non-null. | 211 // Must return non-null. |
217 virtual WebIDBFactory* idbFactory() { return 0; } | 212 virtual WebIDBFactory* idbFactory() { return 0; } |
218 | 213 |
219 | 214 |
220 // Gamepad ------------------------------------------------------------- | 215 // Gamepad ------------------------------------------------------------- |
221 | 216 |
222 virtual void sampleGamepads(WebGamepads& into) { into.length = 0; } | 217 virtual void sampleGamepads(WebGamepads& into) { into.length = 0; } |
223 | 218 |
224 virtual void setGamepadListener(WebGamepadListener*) { } | |
225 | |
226 | 219 |
227 // History ------------------------------------------------------------- | 220 // History ------------------------------------------------------------- |
228 | 221 |
229 // Returns the hash for the given canonicalized URL for use in visited | 222 // Returns the hash for the given canonicalized URL for use in visited |
230 // link coloring. | 223 // link coloring. |
231 virtual unsigned long long visitedLinkHash( | 224 virtual unsigned long long visitedLinkHash( |
232 const char* canonicalURL, size_t length) { return 0; } | 225 const char* canonicalURL, size_t length) { return 0; } |
233 | 226 |
234 // Returns whether the given link hash is in the user's history. The | 227 // Returns whether the given link hash is in the user's history. The |
235 // hash must have been generated by calling VisitedLinkHash(). | 228 // hash must have been generated by calling VisitedLinkHash(). |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 | 589 |
597 virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { } | 590 virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { } |
598 virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { } | 591 virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { } |
599 | 592 |
600 | 593 |
601 // WebCrypto ---------------------------------------------------------- | 594 // WebCrypto ---------------------------------------------------------- |
602 | 595 |
603 virtual WebCrypto* crypto() { return 0; } | 596 virtual WebCrypto* crypto() { return 0; } |
604 | 597 |
605 | 598 |
606 // Device Motion / Orientation / Light ------------------------------------- --- | 599 // Platform events ----------------------------------------------------- |
600 // Device Orientation, Device Motion, Device Light, Battery, Gamepad. | |
607 | 601 |
608 // Sets a Listener to listen for device motion data updates. | 602 // Request the platform to start listening to the specified event and |
timvolodine
2014/07/30 12:56:41
nit: "to the specified event" -> "to events of spe
mlamouri (slow - plz ping)
2014/08/01 10:21:05
Done.
| |
609 // If null, the platform stops providing device motion data to the current l istener. | 603 // notify the given listener (if not null) when there is an update. |
604 virtual void startListening(blink::WebPlatformEventType type, blink::WebPlat formEventListener* listener) | |
abarth-chromium
2014/07/29 22:24:38
Why virtual?
It seems like we should implement th
mlamouri (slow - plz ping)
2014/07/29 22:27:54
The only intent is to not break Chromium when this
| |
605 { | |
606 switch (type) { | |
607 case blink::WebPlatformEventDeviceMotion: | |
608 setDeviceMotionListener(static_cast<blink::WebDeviceMotionListener*> (listener)); | |
609 break; | |
610 case blink::WebPlatformEventDeviceOrientation: | |
611 setDeviceOrientationListener(static_cast<blink::WebDeviceOrientation Listener*>(listener)); | |
612 break; | |
613 case blink::WebPlatformEventDeviceLight: | |
614 setDeviceLightListener(static_cast<blink::WebDeviceLightListener*>(l istener)); | |
615 break; | |
616 case blink::WebPlatformEventBattery: | |
617 setBatteryStatusListener(static_cast<blink::WebBatteryStatusListener *>(listener)); | |
618 break; | |
619 case blink::WebPlatformEventGamepad: | |
620 setGamepadListener(static_cast<blink::WebGamepadListener*>(listener) ); | |
621 break; | |
622 } | |
623 } | |
624 | |
625 // Request the platform to stop listening to the specified event and no | |
626 // longer notify the listener, if any. | |
627 virtual void stopListening(blink::WebPlatformEventType type) | |
628 { | |
629 switch (type) { | |
630 case blink::WebPlatformEventDeviceMotion: | |
631 setDeviceMotionListener(0); | |
632 break; | |
633 case blink::WebPlatformEventDeviceOrientation: | |
634 setDeviceOrientationListener(0); | |
635 break; | |
636 case blink::WebPlatformEventDeviceLight: | |
637 setDeviceLightListener(0); | |
638 break; | |
639 case blink::WebPlatformEventBattery: | |
640 setBatteryStatusListener(0); | |
641 break; | |
642 case blink::WebPlatformEventGamepad: | |
643 setGamepadListener(0); | |
644 break; | |
645 } | |
646 } | |
647 | |
648 // Deprecated: remove when content/ is updated. | |
abarth-chromium
2014/07/30 05:56:23
I see, this comment was intended to communicate th
mlamouri (slow - plz ping)
2014/08/01 10:21:05
Yes. I've added a FIXME to make it clearer.
| |
610 virtual void setDeviceMotionListener(blink::WebDeviceMotionListener*) { } | 649 virtual void setDeviceMotionListener(blink::WebDeviceMotionListener*) { } |
611 | |
612 // Sets a Listener to listen for device orientation data updates. | |
613 // If null, the platform stops providing device orientation data to the curr ent listener. | |
614 virtual void setDeviceOrientationListener(blink::WebDeviceOrientationListene r*) { } | 650 virtual void setDeviceOrientationListener(blink::WebDeviceOrientationListene r*) { } |
615 | |
616 // Sets a Listener to listen for device light data updates. | |
617 // If null, the platform stops providing device light data to the current li stener. | |
618 virtual void setDeviceLightListener(blink::WebDeviceLightListener*) { } | 651 virtual void setDeviceLightListener(blink::WebDeviceLightListener*) { } |
652 virtual void setBatteryStatusListener(blink::WebBatteryStatusListener*) { } | |
653 virtual void setGamepadListener(blink::WebGamepadListener*) { } | |
619 | 654 |
620 | 655 |
621 // Quota ----------------------------------------------------------- | 656 // Quota ----------------------------------------------------------- |
622 | 657 |
623 // Queries the storage partition's storage usage and quota information. | 658 // Queries the storage partition's storage usage and quota information. |
624 // WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota will be called | 659 // WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota will be called |
625 // with the current usage and quota information for the partition. When | 660 // with the current usage and quota information for the partition. When |
626 // an error occurs WebStorageQuotaCallbacks::didFail is called with an | 661 // an error occurs WebStorageQuotaCallbacks::didFail is called with an |
627 // error code. | 662 // error code. |
628 virtual void queryStorageUsageAndQuota( | 663 virtual void queryStorageUsageAndQuota( |
(...skipping 12 matching lines...) Expand all Loading... | |
641 virtual WebNotificationPresenter* notificationPresenter() { return 0; } | 676 virtual WebNotificationPresenter* notificationPresenter() { return 0; } |
642 | 677 |
643 | 678 |
644 protected: | 679 protected: |
645 virtual ~Platform() { } | 680 virtual ~Platform() { } |
646 }; | 681 }; |
647 | 682 |
648 } // namespace blink | 683 } // namespace blink |
649 | 684 |
650 #endif | 685 #endif |
OLD | NEW |