| Index: chrome/browser/android/vr_shell/vr_shell.cc
|
| diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
|
| index 53dfd7eb9d2612dafdecedd7d609b6a6b0b1937b..8c64180e826d2703709415b4a154ea842a54eacb 100644
|
| --- a/chrome/browser/android/vr_shell/vr_shell.cc
|
| +++ b/chrome/browser/android/vr_shell/vr_shell.cc
|
| @@ -35,6 +35,7 @@
|
| #include "content/public/common/referrer.h"
|
| #include "device/vr/android/gvr/gvr_device.h"
|
| #include "device/vr/android/gvr/gvr_device_provider.h"
|
| +#include "device/vr/android/gvr/gvr_gamepad_data_fetcher.h"
|
| #include "gpu/command_buffer/common/mailbox.h"
|
| #include "jni/VrShellImpl_jni.h"
|
| #include "third_party/WebKit/public/platform/WebInputEvent.h"
|
| @@ -177,6 +178,11 @@ bool RegisterVrShell(JNIEnv* env) {
|
| }
|
|
|
| VrShell::~VrShell() {
|
| + if (gamepad_source_active_) {
|
| + device::GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
|
| + device::GAMEPAD_SOURCE_GVR);
|
| + }
|
| +
|
| delegate_provider_->RemoveDelegate();
|
| {
|
| // The GvrLayout is, and must always be, used only on the UI thread, and the
|
| @@ -624,6 +630,24 @@ void VrShell::ProcessContentGesture(
|
| }
|
| }
|
|
|
| +void VrShell::GamepadDataUpdate(device::GvrGamepadData pad) {
|
| + if (!gamepad_source_active_) {
|
| + if (!delegate_provider_->device_provider())
|
| + return;
|
| +
|
| + unsigned int device_id =
|
| + delegate_provider_->device_provider()->Device()->id();
|
| + device::GamepadDataFetcherManager::GetInstance()->AddFactory(
|
| + new device::GvrGamepadDataFetcher::Factory(this, device_id));
|
| + gamepad_source_active_ = true;
|
| + }
|
| + gamepad_data_ = pad;
|
| +}
|
| +
|
| +device::GvrGamepadData VrShell::GamepadDataGet() {
|
| + return gamepad_data_;
|
| +}
|
| +
|
| /* static */
|
| device::mojom::VRPosePtr VrShell::VRPosePtrFromGvrPose(gvr::Mat4f head_mat) {
|
| device::mojom::VRPosePtr pose = device::mojom::VRPose::New();
|
|
|