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 <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 void VrShell::UpdateWebVRTextureBounds(int16_t frame_index, | 378 void VrShell::UpdateWebVRTextureBounds(int16_t frame_index, |
379 const gvr::Rectf& left_bounds, | 379 const gvr::Rectf& left_bounds, |
380 const gvr::Rectf& right_bounds, | 380 const gvr::Rectf& right_bounds, |
381 const gvr::Sizei& source_size) { | 381 const gvr::Sizei& source_size) { |
382 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, | 382 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, |
383 gl_thread_->GetVrShellGl(), frame_index, | 383 gl_thread_->GetVrShellGl(), frame_index, |
384 left_bounds, right_bounds, source_size)); | 384 left_bounds, right_bounds, source_size)); |
385 } | 385 } |
386 | 386 |
387 void VrShell::ResetPose() { | |
388 gl_thread_->task_runner()->PostTask( | |
389 FROM_HERE, base::Bind(&VrShellGl::ResetPose, gl_thread_->GetVrShellGl())); | |
390 } | |
391 | |
392 void VrShell::CreateVRDisplayInfo( | 387 void VrShell::CreateVRDisplayInfo( |
393 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, | 388 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
394 uint32_t device_id) { | 389 uint32_t device_id) { |
395 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo, | 390 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo, |
396 gl_thread_->GetVrShellGl(), callback, | 391 gl_thread_->GetVrShellGl(), callback, |
397 device_id)); | 392 device_id)); |
398 } | 393 } |
399 | 394 |
400 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( | 395 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( |
401 JNIEnv* env, | 396 JNIEnv* env, |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 gvr::GvrApi* gvr_api, | 734 gvr::GvrApi* gvr_api, |
740 gvr::Sizei recommended_size, | 735 gvr::Sizei recommended_size, |
741 uint32_t device_id) { | 736 uint32_t device_id) { |
742 TRACE_EVENT0("input", "GvrDevice::GetVRDevice"); | 737 TRACE_EVENT0("input", "GvrDevice::GetVRDevice"); |
743 | 738 |
744 device::mojom::VRDisplayInfoPtr device = device::mojom::VRDisplayInfo::New(); | 739 device::mojom::VRDisplayInfoPtr device = device::mojom::VRDisplayInfo::New(); |
745 | 740 |
746 device->index = device_id; | 741 device->index = device_id; |
747 | 742 |
748 device->capabilities = device::mojom::VRDisplayCapabilities::New(); | 743 device->capabilities = device::mojom::VRDisplayCapabilities::New(); |
749 device->capabilities->hasOrientation = true; | |
750 device->capabilities->hasPosition = false; | 744 device->capabilities->hasPosition = false; |
751 device->capabilities->hasExternalDisplay = false; | 745 device->capabilities->hasExternalDisplay = false; |
752 device->capabilities->canPresent = true; | 746 device->capabilities->canPresent = true; |
753 | 747 |
754 std::string vendor = gvr_api->GetViewerVendor(); | 748 std::string vendor = gvr_api->GetViewerVendor(); |
755 std::string model = gvr_api->GetViewerModel(); | 749 std::string model = gvr_api->GetViewerModel(); |
756 device->displayName = vendor + " " + model; | 750 device->displayName = vendor + " " + model; |
757 | 751 |
758 gvr::BufferViewportList gvr_buffer_viewports = | 752 gvr::BufferViewportList gvr_buffer_viewports = |
759 gvr_api->CreateEmptyBufferViewportList(); | 753 gvr_api->CreateEmptyBufferViewportList(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 jboolean reprojected_rendering) { | 795 jboolean reprojected_rendering) { |
802 return reinterpret_cast<intptr_t>(new VrShell( | 796 return reinterpret_cast<intptr_t>(new VrShell( |
803 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 797 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
804 content::WebContents::FromJavaWebContents(ui_web_contents), | 798 content::WebContents::FromJavaWebContents(ui_web_contents), |
805 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, | 799 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, |
806 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 800 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
807 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 801 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
808 } | 802 } |
809 | 803 |
810 } // namespace vr_shell | 804 } // namespace vr_shell |
OLD | NEW |