| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 const gvr::Sizei& source_size) { | 355 const gvr::Sizei& source_size) { |
| 356 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, | 356 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, |
| 357 gl_thread_->GetVrShellGl(), frame_index, | 357 gl_thread_->GetVrShellGl(), frame_index, |
| 358 left_bounds, right_bounds, source_size)); | 358 left_bounds, right_bounds, source_size)); |
| 359 } | 359 } |
| 360 | 360 |
| 361 bool VrShell::SupportsPresentation() { | 361 bool VrShell::SupportsPresentation() { |
| 362 return true; | 362 return true; |
| 363 } | 363 } |
| 364 | 364 |
| 365 void VrShell::ResetPose() { | |
| 366 gl_thread_->task_runner()->PostTask( | |
| 367 FROM_HERE, base::Bind(&VrShellGl::ResetPose, gl_thread_->GetVrShellGl())); | |
| 368 } | |
| 369 | |
| 370 void VrShell::CreateVRDisplayInfo( | 365 void VrShell::CreateVRDisplayInfo( |
| 371 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, | 366 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
| 372 uint32_t device_id) { | 367 uint32_t device_id) { |
| 373 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo, | 368 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo, |
| 374 gl_thread_->GetVrShellGl(), callback, | 369 gl_thread_->GetVrShellGl(), callback, |
| 375 device_id)); | 370 device_id)); |
| 376 } | 371 } |
| 377 | 372 |
| 378 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( | 373 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( |
| 379 JNIEnv* env, | 374 JNIEnv* env, |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 gvr::GvrApi* gvr_api, | 712 gvr::GvrApi* gvr_api, |
| 718 gvr::Sizei recommended_size, | 713 gvr::Sizei recommended_size, |
| 719 uint32_t device_id) { | 714 uint32_t device_id) { |
| 720 TRACE_EVENT0("input", "GvrDevice::GetVRDevice"); | 715 TRACE_EVENT0("input", "GvrDevice::GetVRDevice"); |
| 721 | 716 |
| 722 device::mojom::VRDisplayInfoPtr device = device::mojom::VRDisplayInfo::New(); | 717 device::mojom::VRDisplayInfoPtr device = device::mojom::VRDisplayInfo::New(); |
| 723 | 718 |
| 724 device->index = device_id; | 719 device->index = device_id; |
| 725 | 720 |
| 726 device->capabilities = device::mojom::VRDisplayCapabilities::New(); | 721 device->capabilities = device::mojom::VRDisplayCapabilities::New(); |
| 727 device->capabilities->hasOrientation = true; | |
| 728 device->capabilities->hasPosition = false; | 722 device->capabilities->hasPosition = false; |
| 729 device->capabilities->hasExternalDisplay = false; | 723 device->capabilities->hasExternalDisplay = false; |
| 730 device->capabilities->canPresent = true; | 724 device->capabilities->canPresent = true; |
| 731 | 725 |
| 732 std::string vendor = gvr_api->GetViewerVendor(); | 726 std::string vendor = gvr_api->GetViewerVendor(); |
| 733 std::string model = gvr_api->GetViewerModel(); | 727 std::string model = gvr_api->GetViewerModel(); |
| 734 device->displayName = vendor + " " + model; | 728 device->displayName = vendor + " " + model; |
| 735 | 729 |
| 736 gvr::BufferViewportList gvr_buffer_viewports = | 730 gvr::BufferViewportList gvr_buffer_viewports = |
| 737 gvr_api->CreateEmptyBufferViewportList(); | 731 gvr_api->CreateEmptyBufferViewportList(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 jboolean reprojected_rendering) { | 773 jboolean reprojected_rendering) { |
| 780 return reinterpret_cast<intptr_t>(new VrShell( | 774 return reinterpret_cast<intptr_t>(new VrShell( |
| 781 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 775 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 782 content::WebContents::FromJavaWebContents(ui_web_contents), | 776 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 783 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, | 777 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, |
| 784 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 778 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
| 785 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 779 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 786 } | 780 } |
| 787 | 781 |
| 788 } // namespace vr_shell | 782 } // namespace vr_shell |
| OLD | NEW |