19e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block/*
29e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * Copyright 2010, The Android Open Source Project
39e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block *
49e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * Redistribution and use in source and binary forms, with or without
59e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * modification, are permitted provided that the following conditions
69e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * are met:
79e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block *  * Redistributions of source code must retain the above copyright
89e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block *    notice, this list of conditions and the following disclaimer.
99e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block *  * Redistributions in binary form must reproduce the above copyright
109e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block *    notice, this list of conditions and the following disclaimer in the
119e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block *    documentation and/or other materials provided with the distribution.
129e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block *
139e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
149e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
159e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
169e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
179e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
189e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
199e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
209e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
219e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
229e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
239e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
249e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block */
259e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
269e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block#ifndef DeviceOrientationClientAndroid_h
279e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block#define DeviceOrientationClientAndroid_h
289e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
299e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block#include <DeviceOrientationClient.h>
309e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
319e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Blocknamespace WebCore {
329e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Blockclass DeviceOrientationController;
339e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block}
349e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
359e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Blocknamespace android {
369e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
379e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Blockclass WebViewCore;
389e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
399e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block// The Android implementation of DeviceOrientationClient. Acts as a proxy to
409e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block// the real or mock impl, which is owned by the WebViewCore.
419e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Blockclass DeviceOrientationClientAndroid : public WebCore::DeviceOrientationClient {
429e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Blockpublic:
439e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    DeviceOrientationClientAndroid();
449e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
459e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    void setWebViewCore(WebViewCore*);
469e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
479e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    // DeviceOrientationClient methods
489e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    virtual void setController(WebCore::DeviceOrientationController*);
499e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    virtual void startUpdating();
509e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    virtual void stopUpdating();
519e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    virtual WebCore::DeviceOrientation* lastOrientation() const;
52eea0127e7a587bbd6825bb2f47e86e70cb0a5be2Steve Block    virtual void deviceOrientationControllerDestroyed();
539e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
549e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Blockprivate:
559e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    WebCore::DeviceOrientationClient* client() const;
569e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
579e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    WebViewCore* m_webViewCore;
589e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    WebCore::DeviceOrientationController* m_controller;
599e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    // Lazily obtained cache of the client owned by the WebViewCore.
609e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block    mutable WebCore::DeviceOrientationClient* m_client;
619e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block};
629e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
639e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block} // namespace android
649e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block
659e0be7261c268a89a8e318e9fc8534a8092d9e63Steve Block#endif // DeviceOrientationClientAndroid_h
66