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 if (touch_pending_) { | |
mthiesse
2016/11/17 21:03:56
This will only work for cardboard, also check if t
klausw
2016/11/17 21:32:08
Done.
| |
380 touch_pending_ = false; | |
381 std::unique_ptr<WebGestureEvent> gesture(new WebGestureEvent()); | |
382 gesture->sourceDevice = blink::WebGestureDeviceTouchpad; | |
383 gesture->timeStampSeconds = | |
384 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); | |
385 gesture->type = WebInputEvent::GestureTapDown; | |
386 gesture->data.tapDown.width = 0; | |
387 gesture->data.tapDown.height = 0; | |
388 content_input_manager_->ProcessUpdatedGesture(*gesture.get()); | |
389 } | |
390 | |
378 return; | 391 return; |
379 } | 392 } |
380 | 393 |
381 gvr::Vec3f ergo_neutral_pose; | 394 gvr::Vec3f ergo_neutral_pose; |
382 if (!controller_->IsConnected()) { | 395 if (!controller_->IsConnected()) { |
383 // No controller detected, set up a gaze cursor that tracks the | 396 // No controller detected, set up a gaze cursor that tracks the |
384 // forward direction. | 397 // forward direction. |
385 ergo_neutral_pose = {0.0f, 0.0f, -1.0f}; | 398 ergo_neutral_pose = {0.0f, 0.0f, -1.0f}; |
386 controller_quat_ = GetRotationFromZAxis(forward_vector); | 399 controller_quat_ = GetRotationFromZAxis(forward_vector); |
387 } else { | 400 } else { |
(...skipping 640 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 |