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

Unified Diff: chrome/browser/android/vr_shell/vr_controller_manager.h

Issue 2350253004: Controller support for VrShell (Closed)
Patch Set: Created 4 years, 3 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: chrome/browser/android/vr_shell/vr_controller_manager.h
diff --git a/chrome/browser/android/vr_shell/vr_controller_manager.h b/chrome/browser/android/vr_shell/vr_controller_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..7fca7c126a097f1a0237587fc2d4cb91f7437f3a
--- /dev/null
+++ b/chrome/browser/android/vr_shell/vr_controller_manager.h
@@ -0,0 +1,81 @@
+// Copyright 2016 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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_
+#define CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/task_runner_util.h"
+#include "chrome/browser/android/vr_shell/vr_controller.h"
+#include "content/public/browser/android/content_view_core.h"
+#include "content/public/browser/android/vr_content_view_core.h"
+#include "content/public/browser/android/vr_gesture.h"
+#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr.h"
+#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr_controller.h"
+#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr_types.h"
+
+namespace vr_shell {
+
+class VrControllerManager
+ : public base::RefCountedThreadSafe<VrControllerManager> {
+ public:
+ // Controller API entry point.
+ explicit VrControllerManager(gvr_context_* gvr_context);
+
+ std::unique_ptr<gvr::ControllerApi> controller_api_;
bshe 2016/09/21 15:18:41 nit: move to private. And if you want others to ac
asimjour 2016/09/22 14:48:36 Done.
+
+ // Must be called when the Activity gets onResume().
+ void OnResume();
+
+ // Must be called when the Activity gets onPause().
+ void OnPause();
+
+ // Must be called when the GL renderer gets onSurfaceCreated().
+ void Initialize(gvr_context_* gvr_context);
+
+ // Must be called when the GL renderer gets onDrawFrame().
+ VrGesture Update();
+
+ bool IsTouching();
+
+ float TouchPosX();
+
+ float TouchPosY();
+
+ // Must be called when the GL renderer gets onDrawFrame().
+ void ProcessUpdatedGesture(VrGesture gesture);
+ // Must be called when the GL renderer gets onDrawFrame().
+ void ProcessUpdatedUIGesture(VrGesture gesture);
+
+ void SetContentViewCore(
+ content::ContentViewCore* content_content_view_core_ptr,
+ content::ContentViewCore* ui_content_view_core_ptr);
+
+ const gvr_quatf Orientation();
+
+ bool IsTouchDown();
+
+ bool IsTouchUp();
+
+ bool ButtonUp(const int32_t button);
+ bool ButtonDown(const int32_t button);
+
+ bool IsConnected();
+
+ private:
+ content::VrContentViewCore* vr_content_ptr;
+ content::VrContentViewCore* vr_ui_ptr;
+ std::unique_ptr<VrController> vr_controller_;
+
+ void SendGesture(VrGesture gesture,
mthiesse 2016/09/21 17:27:47 nit: Functions above member variables.
asimjour 2016/09/22 14:48:36 Done.
+ content::VrContentViewCore* content_view_core_ptr);
+
+ protected:
mthiesse 2016/09/21 17:27:47 nit: Protected above private seems to be more comm
asimjour 2016/09/22 14:48:36 Done.
+ friend class base::RefCountedThreadSafe<VrControllerManager>;
+ virtual ~VrControllerManager();
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698