| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/vr_shell.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "chrome/browser/android/vr_shell/ui_elements.h" | 8 #include "chrome/browser/android/vr_shell/ui_elements.h" |
| 9 #include "chrome/browser/android/vr_shell/ui_interface.h" | 9 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_scene.h" | 10 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 FROM_HERE, base::Bind(&device::GvrDeviceProvider::OnDisplayBlur, | 368 FROM_HERE, base::Bind(&device::GvrDeviceProvider::OnDisplayBlur, |
| 369 delegate_->GetDeviceProvider())); | 369 delegate_->GetDeviceProvider())); |
| 370 } | 370 } |
| 371 html_interface_->SetMode(UiInterface::Mode::MENU); | 371 html_interface_->SetMode(UiInterface::Mode::MENU); |
| 372 // TODO(mthiesse): The page is no longer visible here. We should unfocus | 372 // TODO(mthiesse): The page is no longer visible here. We should unfocus |
| 373 // or otherwise let it know it's hidden. | 373 // or otherwise let it know it's hidden. |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 #endif | 376 #endif |
| 377 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { | 377 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { |
| 378 // Process screen touch events for Cardboard button compatibility. |
| 379 // Also send tap events for controller "touchpad click" events. |
| 380 if (touch_pending_ || controller_->IsButtonUp( |
| 381 gvr::ControllerButton::GVR_CONTROLLER_BUTTON_CLICK)) { |
| 382 touch_pending_ = false; |
| 383 std::unique_ptr<WebGestureEvent> gesture(new WebGestureEvent()); |
| 384 gesture->sourceDevice = blink::WebGestureDeviceTouchpad; |
| 385 gesture->timeStampSeconds = |
| 386 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); |
| 387 gesture->type = WebInputEvent::GestureTapDown; |
| 388 gesture->data.tapDown.width = 0; |
| 389 gesture->data.tapDown.height = 0; |
| 390 content_input_manager_->ProcessUpdatedGesture(*gesture.get()); |
| 391 } |
| 392 |
| 378 return; | 393 return; |
| 379 } | 394 } |
| 380 | 395 |
| 381 gvr::Vec3f ergo_neutral_pose; | 396 gvr::Vec3f ergo_neutral_pose; |
| 382 if (!controller_->IsConnected()) { | 397 if (!controller_->IsConnected()) { |
| 383 // No controller detected, set up a gaze cursor that tracks the | 398 // No controller detected, set up a gaze cursor that tracks the |
| 384 // forward direction. | 399 // forward direction. |
| 385 ergo_neutral_pose = {0.0f, 0.0f, -1.0f}; | 400 ergo_neutral_pose = {0.0f, 0.0f, -1.0f}; |
| 386 controller_quat_ = GetRotationFromZAxis(forward_vector); | 401 controller_quat_ = GetRotationFromZAxis(forward_vector); |
| 387 } else { | 402 } else { |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 const JavaParamRef<jobject>& ui_web_contents, | 1043 const JavaParamRef<jobject>& ui_web_contents, |
| 1029 jlong ui_window_android) { | 1044 jlong ui_window_android) { |
| 1030 return reinterpret_cast<intptr_t>(new VrShell( | 1045 return reinterpret_cast<intptr_t>(new VrShell( |
| 1031 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 1046 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
| 1032 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 1047 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 1033 content::WebContents::FromJavaWebContents(ui_web_contents), | 1048 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 1034 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); | 1049 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); |
| 1035 } | 1050 } |
| 1036 | 1051 |
| 1037 } // namespace vr_shell | 1052 } // namespace vr_shell |
| OLD | NEW |