summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/DeviceMotionClientImpl.h
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-10-13 04:18:43 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-13 04:18:43 -0700
commit781e60ba5792afa95d7205bf8c00b456602e7468 (patch)
tree4873238ae9a548769fc5f728a406ebfb420b957f /WebKit/android/jni/DeviceMotionClientImpl.h
parent0a12879c6b8ddf8b2b27629dfd999cedd9589959 (diff)
parentd9b2f2e1e22ec3dfc73795d9e5476c7ab7ddb43d (diff)
downloadexternal_webkit-781e60ba5792afa95d7205bf8c00b456602e7468.zip
external_webkit-781e60ba5792afa95d7205bf8c00b456602e7468.tar.gz
external_webkit-781e60ba5792afa95d7205bf8c00b456602e7468.tar.bz2
Merge "Implement DeviceMotionEvent"
Diffstat (limited to 'WebKit/android/jni/DeviceMotionClientImpl.h')
-rw-r--r--WebKit/android/jni/DeviceMotionClientImpl.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/WebKit/android/jni/DeviceMotionClientImpl.h b/WebKit/android/jni/DeviceMotionClientImpl.h
new file mode 100644
index 0000000..364f1d3
--- /dev/null
+++ b/WebKit/android/jni/DeviceMotionClientImpl.h
@@ -0,0 +1,71 @@
+/*
+ * 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 DeviceMotionClientImpl_h
+#define DeviceMotionClientImpl_h
+
+#include <DeviceMotionClient.h>
+#include <DeviceMotionData.h>
+#include <JNIUtility.h>
+#include <PassRefPtr.h>
+#include <RefPtr.h>
+
+using namespace WebCore;
+
+namespace android {
+
+class DeviceOrientationManager;
+class WebViewCore;
+
+class DeviceMotionClientImpl : public DeviceMotionClient {
+public:
+ DeviceMotionClientImpl(WebViewCore*);
+
+ void onMotionChange(PassRefPtr<DeviceMotionData>);
+ void suspend();
+ void resume();
+
+ // DeviceMotionClient methods
+ virtual void startUpdating();
+ virtual void stopUpdating();
+ virtual DeviceMotionData* currentDeviceMotion() const { return m_lastMotion.get(); }
+ virtual void setController(DeviceMotionController* controller) { m_controller = controller; }
+ virtual void deviceMotionControllerDestroyed() { }
+
+protected:
+ virtual ~DeviceMotionClientImpl();
+
+ jobject getJavaInstance();
+ void releaseJavaInstance();
+
+ WebViewCore* m_webViewCore;
+ jobject m_javaServiceObject;
+ DeviceMotionController* m_controller;
+ RefPtr<DeviceMotionData> m_lastMotion;
+};
+
+} // namespace android
+
+#endif // DeviceMotionClientImpl_h