Chromium Code Reviews| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 | 586 |
| 587 // Update the render position of all UI elements (including desktop). | 587 // Update the render position of all UI elements (including desktop). |
| 588 const float screen_tilt = kDesktopScreenTiltDefault * M_PI / 180.0f; | 588 const float screen_tilt = kDesktopScreenTiltDefault * M_PI / 180.0f; |
| 589 scene_->UpdateTransforms(screen_tilt, UiScene::TimeInMicroseconds()); | 589 scene_->UpdateTransforms(screen_tilt, UiScene::TimeInMicroseconds()); |
| 590 | 590 |
| 591 UpdateController(GetForwardVector(head_pose)); | 591 UpdateController(GetForwardVector(head_pose)); |
| 592 | 592 |
| 593 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { | 593 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { |
| 594 DrawWebVr(); | 594 DrawWebVr(); |
| 595 | 595 |
| 596 // Process screen touch events for Cardboard button compatibility. | |
| 597 if (touch_pending_) { | |
|
bajones
2016/11/17 20:42:53
Shouldn't this go in UpdateController under the if
klausw
2016/11/17 21:00:00
Yes, that's a much better fit. Moved.
| |
| 598 touch_pending_ = false; | |
| 599 std::unique_ptr<WebGestureEvent> gesture(new WebGestureEvent()); | |
| 600 gesture->sourceDevice = blink::WebGestureDeviceTouchpad; | |
| 601 gesture->timeStampSeconds = | |
| 602 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); | |
| 603 gesture->type = WebInputEvent::GestureTapDown; | |
| 604 gesture->data.tapDown.width = 0; | |
| 605 gesture->data.tapDown.height = 0; | |
| 606 content_input_manager_->ProcessUpdatedGesture(*gesture.get()); | |
| 607 } | |
| 608 | |
| 596 // When using async reprojection, we need to know which pose was used in | 609 // When using async reprojection, we need to know which pose was used in |
| 597 // the WebVR app for drawing this frame. Due to unknown amounts of | 610 // the WebVR app for drawing this frame. Due to unknown amounts of |
| 598 // buffering in the compositor and SurfaceTexture, we read the pose number | 611 // buffering in the compositor and SurfaceTexture, we read the pose number |
| 599 // from a corner pixel. There's no point in doing this for legacy | 612 // from a corner pixel. There's no point in doing this for legacy |
| 600 // distortion rendering since that doesn't need a pose, and reading back | 613 // distortion rendering since that doesn't need a pose, and reading back |
| 601 // pixels is an expensive operation. TODO(klausw,crbug.com/655722): stop | 614 // pixels is an expensive operation. TODO(klausw,crbug.com/655722): stop |
| 602 // doing this once we have working no-compositor rendering for WebVR. | 615 // doing this once we have working no-compositor rendering for WebVR. |
| 603 if (gvr_api_->GetAsyncReprojectionEnabled()) { | 616 if (gvr_api_->GetAsyncReprojectionEnabled()) { |
| 604 uint32_t webvr_pose_frame = GetPixelEncodedPoseIndex(); | 617 uint32_t webvr_pose_frame = GetPixelEncodedPoseIndex(); |
| 605 // If we don't get a valid frame ID back we shouldn't attempt to reproject | 618 // If we don't get a valid frame ID back we shouldn't attempt to reproject |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1028 const JavaParamRef<jobject>& ui_web_contents, | 1041 const JavaParamRef<jobject>& ui_web_contents, |
| 1029 jlong ui_window_android) { | 1042 jlong ui_window_android) { |
| 1030 return reinterpret_cast<intptr_t>(new VrShell( | 1043 return reinterpret_cast<intptr_t>(new VrShell( |
| 1031 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 1044 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
| 1032 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 1045 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 1033 content::WebContents::FromJavaWebContents(ui_web_contents), | 1046 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 1034 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); | 1047 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); |
| 1035 } | 1048 } |
| 1036 | 1049 |
| 1037 } // namespace vr_shell | 1050 } // namespace vr_shell |
| OLD | NEW |