diff options
author | Steve Block <steveblock@google.com> | 2010-08-02 10:30:48 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-08-05 12:32:39 +0100 |
commit | 9e0be7261c268a89a8e318e9fc8534a8092d9e63 (patch) | |
tree | 0a4a4a3f2dc84a211a290a85ab6a782a51bfeb98 /WebKit/android/WebCoreSupport/DeviceOrientationClientAndroid.h | |
parent | fe45d90a3acac116778548c44389e1110f5337ba (diff) | |
download | external_webkit-9e0be7261c268a89a8e318e9fc8534a8092d9e63.zip external_webkit-9e0be7261c268a89a8e318e9fc8534a8092d9e63.tar.gz external_webkit-9e0be7261c268a89a8e318e9fc8534a8092d9e63.tar.bz2 |
Implement DeviceOrientationClientAndroid
This class acts simply as a proxy to the real or mock client, which is owned by
the WebView. DEVICE_ORIENTATION is eabled on Android, so we must implement the
client before we pull in http://trac.webkit.org/changeset/64356, which calls
DeviceOrientationClient::setController() from the Page constructor.
Change-Id: Ie21957249e5bef7a58c51205732f4fb1b82fbbd3
Diffstat (limited to 'WebKit/android/WebCoreSupport/DeviceOrientationClientAndroid.h')
-rw-r--r-- | WebKit/android/WebCoreSupport/DeviceOrientationClientAndroid.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/DeviceOrientationClientAndroid.h b/WebKit/android/WebCoreSupport/DeviceOrientationClientAndroid.h new file mode 100644 index 0000000..cc55cb8 --- /dev/null +++ b/WebKit/android/WebCoreSupport/DeviceOrientationClientAndroid.h @@ -0,0 +1,64 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DeviceOrientationClientAndroid_h +#define DeviceOrientationClientAndroid_h + +#include <DeviceOrientationClient.h> + +namespace WebCore { +class DeviceOrientationController; +} + +namespace android { + +class WebViewCore; + +// The Android implementation of DeviceOrientationClient. Acts as a proxy to +// the real or mock impl, which is owned by the WebViewCore. +class DeviceOrientationClientAndroid : public WebCore::DeviceOrientationClient { +public: + DeviceOrientationClientAndroid(); + + void setWebViewCore(WebViewCore*); + + // DeviceOrientationClient methods + virtual void setController(WebCore::DeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual WebCore::DeviceOrientation* lastOrientation() const; + +private: + WebCore::DeviceOrientationClient* client() const; + + WebViewCore* m_webViewCore; + WebCore::DeviceOrientationController* m_controller; + // Lazily obtained cache of the client owned by the WebViewCore. + mutable WebCore::DeviceOrientationClient* m_client; +}; + +} // namespace android + +#endif // DeviceOrientationClientAndroid_h |