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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 // WebWorker ---------------------------------------------------------- | 588 // WebWorker ---------------------------------------------------------- |
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 // WebCrypto ---------------------------------------------------------- | 593 // WebCrypto ---------------------------------------------------------- |
601 | 594 |
602 virtual WebCrypto* crypto() { return 0; } | 595 virtual WebCrypto* crypto() { return 0; } |
603 | 596 |
604 | 597 |
605 // Device Motion / Orientation / Light -------------------------------------
--- | 598 // Platform events ----------------------------------------------------- |
| 599 // Device Orientation, Device Motion, Device Light, Battery, Gamepad. |
606 | 600 |
607 // Sets a Listener to listen for device motion data updates. | 601 // Request the platform to start listening to the events of the specified |
608 // If null, the platform stops providing device motion data to the current l
istener. | 602 // type and notify the given listener (if not null) when there is an update. |
| 603 virtual void startListening(blink::WebPlatformEventType type, blink::WebPlat
formEventListener* listener) |
| 604 { |
| 605 // FIXME: this implementation is only there for backward compatibility. |
| 606 // It should be removed when the content layer will implement this metho
d. |
| 607 switch (type) { |
| 608 case blink::WebPlatformEventDeviceMotion: |
| 609 setDeviceMotionListener(static_cast<blink::WebDeviceMotionListener*>
(listener)); |
| 610 break; |
| 611 case blink::WebPlatformEventDeviceOrientation: |
| 612 setDeviceOrientationListener(static_cast<blink::WebDeviceOrientation
Listener*>(listener)); |
| 613 break; |
| 614 case blink::WebPlatformEventDeviceLight: |
| 615 setDeviceLightListener(static_cast<blink::WebDeviceLightListener*>(l
istener)); |
| 616 break; |
| 617 case blink::WebPlatformEventBattery: |
| 618 setBatteryStatusListener(static_cast<blink::WebBatteryStatusListener
*>(listener)); |
| 619 break; |
| 620 case blink::WebPlatformEventGamepad: |
| 621 setGamepadListener(static_cast<blink::WebGamepadListener*>(listener)
); |
| 622 break; |
| 623 } |
| 624 } |
| 625 |
| 626 // Request the platform to stop listening to the specified event and no |
| 627 // longer notify the listener, if any. |
| 628 virtual void stopListening(blink::WebPlatformEventType type) |
| 629 { |
| 630 // FIXME: this implementation is only there for backward compatibility. |
| 631 // It should be removed when the content layer will implement this metho
d. |
| 632 switch (type) { |
| 633 case blink::WebPlatformEventDeviceMotion: |
| 634 setDeviceMotionListener(0); |
| 635 break; |
| 636 case blink::WebPlatformEventDeviceOrientation: |
| 637 setDeviceOrientationListener(0); |
| 638 break; |
| 639 case blink::WebPlatformEventDeviceLight: |
| 640 setDeviceLightListener(0); |
| 641 break; |
| 642 case blink::WebPlatformEventBattery: |
| 643 setBatteryStatusListener(0); |
| 644 break; |
| 645 case blink::WebPlatformEventGamepad: |
| 646 setGamepadListener(0); |
| 647 break; |
| 648 } |
| 649 } |
| 650 |
| 651 // Deprecated: remove when content/ is updated. |
609 virtual void setDeviceMotionListener(blink::WebDeviceMotionListener*) { } | 652 virtual void setDeviceMotionListener(blink::WebDeviceMotionListener*) { } |
610 | |
611 // Sets a Listener to listen for device orientation data updates. | |
612 // If null, the platform stops providing device orientation data to the curr
ent listener. | |
613 virtual void setDeviceOrientationListener(blink::WebDeviceOrientationListene
r*) { } | 653 virtual void setDeviceOrientationListener(blink::WebDeviceOrientationListene
r*) { } |
614 | |
615 // Sets a Listener to listen for device light data updates. | |
616 // If null, the platform stops providing device light data to the current li
stener. | |
617 virtual void setDeviceLightListener(blink::WebDeviceLightListener*) { } | 654 virtual void setDeviceLightListener(blink::WebDeviceLightListener*) { } |
| 655 virtual void setBatteryStatusListener(blink::WebBatteryStatusListener*) { } |
| 656 virtual void setGamepadListener(blink::WebGamepadListener*) { } |
618 | 657 |
619 | 658 |
620 // Quota ----------------------------------------------------------- | 659 // Quota ----------------------------------------------------------- |
621 | 660 |
622 // Queries the storage partition's storage usage and quota information. | 661 // Queries the storage partition's storage usage and quota information. |
623 // WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota will be called | 662 // WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota will be called |
624 // with the current usage and quota information for the partition. When | 663 // with the current usage and quota information for the partition. When |
625 // an error occurs WebStorageQuotaCallbacks::didFail is called with an | 664 // an error occurs WebStorageQuotaCallbacks::didFail is called with an |
626 // error code. | 665 // error code. |
627 virtual void queryStorageUsageAndQuota( | 666 virtual void queryStorageUsageAndQuota( |
(...skipping 12 matching lines...) Expand all Loading... |
640 virtual WebNotificationPresenter* notificationPresenter() { return 0; } | 679 virtual WebNotificationPresenter* notificationPresenter() { return 0; } |
641 | 680 |
642 | 681 |
643 protected: | 682 protected: |
644 virtual ~Platform() { } | 683 virtual ~Platform() { } |
645 }; | 684 }; |
646 | 685 |
647 } // namespace blink | 686 } // namespace blink |
648 | 687 |
649 #endif | 688 #endif |
OLD | NEW |