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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2879973002: Expose Gamepad API instance for Cardboard button (Closed)
Patch Set: fix crash in tests Created 3 years, 7 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_shell_gl.h ('k') | device/gamepad/gamepad_pad_state_provider.h » ('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_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 65cc835187302e13ebd1d9266e54d0b50d144d13..452f39debd789433d5143a72349ad28b42af476d 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -454,6 +454,11 @@ void VrShellGl::GvrInit(gvr_context* gvr_api) {
}
UMA_HISTOGRAM_ENUMERATION("VRViewerType", static_cast<int>(viewerType),
static_cast<int>(ViewerType::VIEWER_TYPE_MAX));
+
+ cardboard_ = (viewerType == ViewerType::CARDBOARD);
+ if (cardboard_ && web_vr_mode_) {
+ browser_->ToggleCardboardGamepad(true);
+ }
}
void VrShellGl::InitializeRenderer() {
@@ -538,7 +543,8 @@ void VrShellGl::UpdateController(const gfx::Vector3dF& head_direction) {
controller_->UpdateState(head_direction);
pointer_start_ = controller_->GetPointerStart();
- browser_->UpdateGamepadData(controller_->GetGamepadData());
+ device::GvrGamepadData controller_data = controller_->GetGamepadData();
+ browser_->UpdateGamepadData(controller_data);
}
void VrShellGl::HandleControllerInput(const gfx::Vector3dF& head_direction) {
@@ -1402,6 +1408,11 @@ void VrShellGl::OnResume() {
void VrShellGl::SetWebVrMode(bool enabled) {
web_vr_mode_ = enabled;
+
+ if (cardboard_) {
+ browser_->ToggleCardboardGamepad(enabled);
+ }
+
if (!enabled) {
submit_client_.reset();
}
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | device/gamepad/gamepad_pad_state_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698