Commit 6c5543c9 authored by Jacob DeWitt's avatar Jacob DeWitt Committed by Commit Bot

Remove GvrGamepadDataProvider

It is no longer needed, now that WebVR is gone.

Change-Id: I7bfca2156c06a447439c42b08673e5d422daf628
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893526Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Commit-Queue: Jacob DeWitt <jacde@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713640}
parent 036c021b
...@@ -27,6 +27,7 @@ static_library("vr_android") { ...@@ -27,6 +27,7 @@ static_library("vr_android") {
"gl_browser_interface.h", "gl_browser_interface.h",
"gvr_consent_helper_impl.cc", "gvr_consent_helper_impl.cc",
"gvr_consent_helper_impl.h", "gvr_consent_helper_impl.h",
"gvr_gamepad_data.h",
"gvr_graphics_delegate.cc", "gvr_graphics_delegate.cc",
"gvr_graphics_delegate.h", "gvr_graphics_delegate.h",
"gvr_input_delegate.cc", "gvr_input_delegate.cc",
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#include <memory> #include <memory>
#include "base/android/jni_weak_ref.h" #include "base/android/jni_weak_ref.h"
#include "chrome/browser/android/vr/gvr_gamepad_data.h"
#include "chrome/browser/vr/assets_load_status.h" #include "chrome/browser/vr/assets_load_status.h"
#include "chrome/browser/vr/ui_test_input.h" #include "chrome/browser/vr/ui_test_input.h"
#include "device/vr/android/gvr/gvr_gamepad_data_provider.h"
#include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/public/mojom/vr_service.mojom.h"
#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h" #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
#include "ui/gfx/transform.h" #include "ui/gfx/transform.h"
...@@ -36,7 +36,7 @@ class GlBrowserInterface { ...@@ -36,7 +36,7 @@ class GlBrowserInterface {
virtual void SendRequestPresentReply(device::mojom::XRSessionPtr) = 0; virtual void SendRequestPresentReply(device::mojom::XRSessionPtr) = 0;
virtual void DialogSurfaceCreated(jobject surface, virtual void DialogSurfaceCreated(jobject surface,
gl::SurfaceTexture* texture) = 0; gl::SurfaceTexture* texture) = 0;
virtual void UpdateGamepadData(device::GvrGamepadData) = 0; virtual void UpdateGamepadData(GvrGamepadData) = 0;
virtual void ToggleCardboardGamepad(bool enabled) = 0; virtual void ToggleCardboardGamepad(bool enabled) = 0;
}; };
......
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef DEVICE_VR_ANDROID_GVR_GVR_GAMEPAD_DATA_PROVIDER_H_ #ifndef CHROME_BROWSER_ANDROID_VR_GVR_GAMEPAD_DATA_H_
#define DEVICE_VR_ANDROID_GVR_GVR_GAMEPAD_DATA_PROVIDER_H_ #define CHROME_BROWSER_ANDROID_VR_GVR_GAMEPAD_DATA_H_
#include "ui/gfx/geometry/quaternion.h" #include "ui/gfx/geometry/quaternion.h"
#include "ui/gfx/geometry/vector2d_f.h" #include "ui/gfx/geometry/vector2d_f.h"
#include "ui/gfx/geometry/vector3d_f.h" #include "ui/gfx/geometry/vector3d_f.h"
namespace device { namespace vr {
class GvrGamepadDataFetcher;
// Subset of GVR controller data needed for the gamepad API. Filled in // Subset of GVR controller data needed for the gamepad API. Filled in
// by vr_shell's VrController and consumed by GvrGamepadDataFetcher. // by vr_shell's VrController.
struct GvrGamepadData { struct GvrGamepadData {
GvrGamepadData() GvrGamepadData()
: timestamp(0), : timestamp(0),
...@@ -33,39 +31,5 @@ struct GvrGamepadData { ...@@ -33,39 +31,5 @@ struct GvrGamepadData {
bool connected; bool connected;
}; };
// This class exposes GVR controller data to the gamepad API. Data is } // namespace vr
// polled by GvrSchedulerDelegate, then pushed from VrShell which implements the #endif // CHROME_BROWSER_ANDROID_VR_GVR_GAMEPAD_DATA_H_
// GvrGamepadDataProvider interface.
//
// More specifically, here's the lifecycle, assuming VrShell
// implements GvrGamepadDataProvider:
//
// - VrShell creates GvrGamepadDataFetcherFactory from
// VrShell::UpdateGamepadData.
//
// - GvrGamepadDataFetcherFactory creates GvrGamepadDataFetcher.
//
// - GvrGamepadDataFetcher registers itself with VrShell via
// VrShell::RegisterGamepadDataFetcher.
//
// - While presenting, VrShell::UpdateGamepadData calls
// GvrGamepadDataFetcher->SetGamepadData to push poses,
// GvrGamepadDataFetcher::GetGamepadData returns these when polled.
//
// - VrShell starts executing its destructor.
//
// - VrShell destructor unregisters GvrGamepadDataFetcherFactory.
//
// - GvrGamepadDataFetcherFactory destructor destroys GvrGamepadDataFetcher.
//
class GvrGamepadDataProvider {
public:
// Refresh current GVR controller data for use by gamepad API. The
// implementation also lazily creates and registers the GVR
// GamepadDataFetcherFactory with the GamepadDataFetcherManager as
// needed.
virtual void UpdateGamepadData(GvrGamepadData data) = 0;
};
} // namespace device
#endif // DEVICE_VR_ANDROID_GVR_GVR_GAMEPAD_DATA_PROVIDER_H_
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
namespace { namespace {
constexpr gfx::Vector3dF kForwardVector = {0.0f, 0.0f, -1.0f}; constexpr gfx::Vector3dF kForwardVector = {0.0f, 0.0f, -1.0f};
device::Gamepad CreateGamepad(const device::GvrGamepadData& data) { device::Gamepad CreateGamepad(const vr::GvrGamepadData& data) {
device::Gamepad gamepad; device::Gamepad gamepad;
// Unless the controller state is updated on a different thread, // Unless the controller state is updated on a different thread,
...@@ -81,7 +81,7 @@ void GvrInputDelegate::UpdateController(const gfx::Transform& head_pose, ...@@ -81,7 +81,7 @@ void GvrInputDelegate::UpdateController(const gfx::Transform& head_pose,
bool is_webxr_frame) { bool is_webxr_frame) {
controller_->UpdateState(head_pose); controller_->UpdateState(head_pose);
device::GvrGamepadData controller_data = controller_->GetGamepadData(); GvrGamepadData controller_data = controller_->GetGamepadData();
if (!is_webxr_frame) if (!is_webxr_frame)
controller_data.connected = false; controller_data.connected = false;
browser_->UpdateGamepadData(controller_data); browser_->UpdateGamepadData(controller_data);
......
...@@ -93,8 +93,8 @@ void VrController::OnPause() { ...@@ -93,8 +93,8 @@ void VrController::OnPause() {
controller_api_->Pause(); controller_api_->Pause();
} }
device::GvrGamepadData VrController::GetGamepadData() { GvrGamepadData VrController::GetGamepadData() {
device::GvrGamepadData pad = {}; GvrGamepadData pad = {};
pad.connected = IsConnected(); pad.connected = IsConnected();
pad.timestamp = controller_state_->GetLastOrientationTimestamp(); pad.timestamp = controller_state_->GetLastOrientationTimestamp();
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/android/vr/gvr_gamepad_data.h"
#include "chrome/browser/android/vr/gvr_util.h" #include "chrome/browser/android/vr/gvr_util.h"
#include "chrome/browser/vr/gesture_detector.h" #include "chrome/browser/vr/gesture_detector.h"
#include "chrome/browser/vr/platform_controller.h" #include "chrome/browser/vr/platform_controller.h"
#include "device/vr/android/gvr/gvr_gamepad_data_provider.h"
#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h" #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
#include "ui/gfx/geometry/point3_f.h" #include "ui/gfx/geometry/point3_f.h"
#include "ui/gfx/geometry/quaternion.h" #include "ui/gfx/geometry/quaternion.h"
...@@ -47,7 +47,7 @@ class VrController : public PlatformController { ...@@ -47,7 +47,7 @@ class VrController : public PlatformController {
// Must be called when the Activity gets OnPause(). // Must be called when the Activity gets OnPause().
void OnPause(); void OnPause();
device::GvrGamepadData GetGamepadData(); GvrGamepadData GetGamepadData();
// Called once per frame to update controller state. // Called once per frame to update controller state.
void UpdateState(const gfx::Transform& head_pose); void UpdateState(const gfx::Transform& head_pose);
......
...@@ -118,7 +118,7 @@ void VrGLThread::SendRequestPresentReply(device::mojom::XRSessionPtr session) { ...@@ -118,7 +118,7 @@ void VrGLThread::SendRequestPresentReply(device::mojom::XRSessionPtr session) {
weak_vr_shell_, std::move(session))); weak_vr_shell_, std::move(session)));
} }
void VrGLThread::UpdateGamepadData(device::GvrGamepadData pad) { void VrGLThread::UpdateGamepadData(GvrGamepadData pad) {
DCHECK(OnGlThread()); DCHECK(OnGlThread());
main_thread_task_runner_->PostTask( main_thread_task_runner_->PostTask(
FROM_HERE, FROM_HERE,
......
...@@ -71,7 +71,7 @@ class VrGLThread : public base::android::JavaHandlerThread, ...@@ -71,7 +71,7 @@ class VrGLThread : public base::android::JavaHandlerThread,
void SendRequestPresentReply(device::mojom::XRSessionPtr) override; void SendRequestPresentReply(device::mojom::XRSessionPtr) override;
void DialogSurfaceCreated(jobject surface, void DialogSurfaceCreated(jobject surface,
gl::SurfaceTexture* texture) override; gl::SurfaceTexture* texture) override;
void UpdateGamepadData(device::GvrGamepadData) override; void UpdateGamepadData(GvrGamepadData) override;
void ToggleCardboardGamepad(bool enabled) override; void ToggleCardboardGamepad(bool enabled) override;
// BrowserRendererBrowserInterface implementation (BrowserRenderer calling to // BrowserRendererBrowserInterface implementation (BrowserRenderer calling to
......
...@@ -1073,7 +1073,7 @@ void VrShell::ProcessDialogGesture(std::unique_ptr<InputEvent> event) { ...@@ -1073,7 +1073,7 @@ void VrShell::ProcessDialogGesture(std::unique_ptr<InputEvent> event) {
dialog_gesture_target_->DispatchInputEvent(std::move(event)); dialog_gesture_target_->DispatchInputEvent(std::move(event));
} }
void VrShell::UpdateGamepadData(device::GvrGamepadData pad) { void VrShell::UpdateGamepadData(GvrGamepadData pad) {
if (gvr_gamepad_source_active_ != pad.connected) if (gvr_gamepad_source_active_ != pad.connected)
ToggleGvrGamepad(pad.connected); ToggleGvrGamepad(pad.connected);
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "chrome/browser/android/vr/gvr_gamepad_data.h"
#include "chrome/browser/ui/page_info/page_info_ui.h" #include "chrome/browser/ui/page_info/page_info_ui.h"
#include "chrome/browser/ui/toolbar/chrome_location_bar_model_delegate.h" #include "chrome/browser/ui/toolbar/chrome_location_bar_model_delegate.h"
#include "chrome/browser/vr/assets_load_status.h" #include "chrome/browser/vr/assets_load_status.h"
...@@ -28,7 +29,6 @@ ...@@ -28,7 +29,6 @@
#include "chrome/browser/vr/ui_initial_state.h" #include "chrome/browser/vr/ui_initial_state.h"
#include "chrome/browser/vr/ui_unsupported_mode.h" #include "chrome/browser/vr/ui_unsupported_mode.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "device/vr/android/gvr/gvr_gamepad_data_provider.h"
#include "device/vr/public/cpp/session_mode.h" #include "device/vr/public/cpp/session_mode.h"
#include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/vr_device.h" #include "device/vr/vr_device.h"
...@@ -65,8 +65,7 @@ struct AutocompleteRequest; ...@@ -65,8 +65,7 @@ struct AutocompleteRequest;
// The native instance of the Java VrShell. This class is not threadsafe and // The native instance of the Java VrShell. This class is not threadsafe and
// must only be used on the UI thread. // must only be used on the UI thread.
class VrShell : device::GvrGamepadDataProvider, class VrShell : VoiceResultDelegate,
VoiceResultDelegate,
public ChromeLocationBarModelDelegate, public ChromeLocationBarModelDelegate,
public PageInfoUI { public PageInfoUI {
public: public:
...@@ -255,8 +254,7 @@ class VrShell : device::GvrGamepadDataProvider, ...@@ -255,8 +254,7 @@ class VrShell : device::GvrGamepadDataProvider,
device::mojom::VRDisplayInfoPtr display_info, device::mojom::VRDisplayInfoPtr display_info,
device::mojom::XRRuntimeSessionOptionsPtr options); device::mojom::XRRuntimeSessionOptionsPtr options);
// device::GvrGamepadDataProvider implementation. void UpdateGamepadData(GvrGamepadData);
void UpdateGamepadData(device::GvrGamepadData) override;
// ChromeLocationBarModelDelegate implementation. // ChromeLocationBarModelDelegate implementation.
content::WebContents* GetActiveWebContents() const override; content::WebContents* GetActiveWebContents() const override;
......
...@@ -65,7 +65,6 @@ if (enable_vr) { ...@@ -65,7 +65,6 @@ if (enable_vr) {
"android/gvr/gvr_device.h", "android/gvr/gvr_device.h",
"android/gvr/gvr_device_provider.cc", "android/gvr/gvr_device_provider.cc",
"android/gvr/gvr_device_provider.h", "android/gvr/gvr_device_provider.h",
"android/gvr/gvr_gamepad_data_provider.h",
"android/gvr/gvr_utils.cc", "android/gvr/gvr_utils.cc",
"android/gvr/gvr_utils.h", "android/gvr/gvr_utils.h",
] ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment