Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: content/browser/gamepad/gamepad_platform_data_fetcher_android.h

Issue 165483003: Gamepad API for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated comments Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/gamepad/gamepad_platform_data_fetcher_android.h
diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_android.h b/content/browser/gamepad/gamepad_platform_data_fetcher_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..b74ef28fb3dbccbb2aecd41bfe02e84357cba917
--- /dev/null
+++ b/content/browser/gamepad/gamepad_platform_data_fetcher_android.h
@@ -0,0 +1,53 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_DATA_FETCHER_ANDROID_H_
+#define CONTENT_BROWSER_GAMEPAD_GAMEPAD_DATA_FETCHER_ANDROID_H_
+
+#include <jni.h>
+
+#include "base/android/jni_android.h"
+#include "base/synchronization/lock.h"
+#include "content/browser/gamepad/gamepad_data_fetcher.h"
+#include "content/browser/gamepad/gamepad_standard_mappings.h"
+#include "third_party/WebKit/public/platform/WebGamepads.h"
+
+namespace content {
+
+class GamepadPlatformDataFetcherAndroid : public GamepadDataFetcher {
+ public:
+ GamepadPlatformDataFetcherAndroid();
+ virtual ~GamepadPlatformDataFetcherAndroid();
+
+ // GamepadDataFetcher implementation.
+ virtual void GetGamepadData(blink::WebGamepads* pads,
+ bool devices_changed_hint) OVERRIDE;
+ virtual void PauseHint(bool paused);
jdduke (slow) 2014/03/07 23:16:39 OVERRIDE?
kbalazs 2014/03/12 00:17:36 Done.
+
+ // Called by GamepadAdapter (java).
+ void RefreshDevice(JNIEnv* env,
jdduke (slow) 2014/03/07 23:16:39 See .cc comments about how this function can be ma
kbalazs 2014/03/12 00:17:36 I think the jni generator only supports methods so
jdduke (slow) 2014/03/12 01:06:18 ViewConfiguration https://code.google.com/p/chromi
+ jobject obj,
+ int index,
+ bool connected,
+ jstring id,
+ jstring mapping,
+ long timestamp,
+ jfloatArray axes,
+ jfloatArray buttons);
+
+ static bool RegisterGamepadAdapter(JNIEnv* env);
+
+ private:
+ // Data to fetch into.
+ blink::WebGamepads* data_;
jdduke (slow) 2014/03/07 23:16:39 I'm not sure we need to hold on to this reference.
kbalazs 2014/03/12 00:17:36 I kept it as I think it makes more sense than pass
jdduke (slow) 2014/03/12 01:06:18 Except, we're not passing "back and forth" as much
+
+ // The java GamepadAdapter object.
+ base::android::ScopedJavaGlobalRef<jobject> j_gamepad_adapter_;
jdduke (slow) 2014/03/07 23:16:39 I'm not sure we need this either. The call into t
kbalazs 2014/03/12 00:17:36 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherAndroid);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_DATA_FETCHER_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698