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

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

Issue 2762003002: Refactor GVR controller gamepad API integration (Closed)
Patch Set: Rebase, no changes Created 3 years, 9 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
« no previous file with comments | « chrome/browser/android/vr_shell/vr_controller.cc ('k') | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell.h
diff --git a/chrome/browser/android/vr_shell/vr_shell.h b/chrome/browser/android/vr_shell/vr_shell.h
index da83a6a714deeb035a04e90d60d2478b2089d0d4..7a3de3000f39c4ee92d3cc28a4516f973d1463f3 100644
--- a/chrome/browser/android/vr_shell/vr_shell.h
+++ b/chrome/browser/android/vr_shell/vr_shell.h
@@ -17,6 +17,7 @@
#include "chrome/browser/android/vr_shell/ui_interface.h"
#include "content/public/browser/web_contents_observer.h"
#include "device/vr/android/gvr/gvr_delegate.h"
+#include "device/vr/android/gvr/gvr_gamepad_data_provider.h"
#include "device/vr/vr_service.mojom.h"
#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h"
#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
@@ -71,7 +72,9 @@ class VrMetricsHelper;
// The native instance of the Java VrShell. This class is not threadsafe and
// must only be used on the UI thread.
-class VrShell : public device::GvrDelegate, content::WebContentsObserver {
+class VrShell : public device::GvrDelegate,
+ content::WebContentsObserver,
+ device::GvrGamepadDataProvider {
public:
VrShell(JNIEnv* env,
jobject obj,
@@ -175,6 +178,10 @@ class VrShell : public device::GvrDelegate, content::WebContentsObserver {
void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event);
void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
+ // device::GvrGamepadDataProvider implementation.
+ void UpdateGamepadData(device::GvrGamepadData) override;
+ void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override;
+
// TODO(mthiesse): Find a better place for these functions to live.
static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat);
static gvr::Sizei GetRecommendedWebVrSize(gvr::GvrApi* gvr_api);
@@ -248,6 +255,12 @@ class VrShell : public device::GvrDelegate, content::WebContentsObserver {
// crbug.com/674594
gvr_context* gvr_api_;
+ // Are we currently providing a gamepad factory to the gamepad manager?
+ bool gamepad_source_active_ = false;
+ // Registered fetcher, must remain alive for UpdateGamepadData calls.
+ // That's ok since the fetcher is only destroyed from VrShell's destructor.
+ device::GvrGamepadDataFetcher* gamepad_data_fetcher_ = nullptr;
+
base::WeakPtrFactory<VrShell> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(VrShell);
« no previous file with comments | « chrome/browser/android/vr_shell/vr_controller.cc ('k') | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698