| 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 "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 return {size.width(), size.height()}; | 287 return {size.width(), size.height()}; |
| 288 } | 288 } |
| 289 | 289 |
| 290 void VrShell::SetWebVRSecureOrigin(bool secure_origin) { | 290 void VrShell::SetWebVRSecureOrigin(bool secure_origin) { |
| 291 // TODO(cjgrant): Align this state with the logic that drives the omnibox. | 291 // TODO(cjgrant): Align this state with the logic that drives the omnibox. |
| 292 html_interface_->SetWebVRSecureOrigin(secure_origin); | 292 html_interface_->SetWebVRSecureOrigin(secure_origin); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void VrShell::SubmitWebVRFrame() {} | 295 void VrShell::SubmitWebVRFrame() {} |
| 296 | 296 |
| 297 void VrShell::UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, | 297 void VrShell::UpdateWebVRTextureBounds(uint32_t frame_index, |
| 298 const gvr::Rectf& left_bounds, |
| 298 const gvr::Rectf& right_bounds) { | 299 const gvr::Rectf& right_bounds) { |
| 299 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); | 300 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); |
| 300 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, | 301 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, |
| 301 thread->GetVrShellGl(), left_bounds, | 302 thread->GetVrShellGl(), frame_index, |
| 302 right_bounds)); | 303 left_bounds, right_bounds)); |
| 303 } | 304 } |
| 304 | 305 |
| 305 // TODO(mthiesse): Do not expose GVR API outside of GL thread. | 306 // TODO(mthiesse): Do not expose GVR API outside of GL thread. |
| 306 // It's not thread-safe. | 307 // It's not thread-safe. |
| 307 gvr::GvrApi* VrShell::gvr_api() { | 308 gvr::GvrApi* VrShell::gvr_api() { |
| 308 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); | 309 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); |
| 309 if (thread->GetVrShellGlUnsafe()) { | 310 if (thread->GetVrShellGlUnsafe()) { |
| 310 return thread->GetVrShellGlUnsafe()->gvr_api(); | 311 return thread->GetVrShellGlUnsafe()->gvr_api(); |
| 311 } | 312 } |
| 312 CHECK(false); | 313 CHECK(false); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 return reinterpret_cast<intptr_t>(new VrShell( | 477 return reinterpret_cast<intptr_t>(new VrShell( |
| 477 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 478 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
| 478 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 479 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 479 content::WebContents::FromJavaWebContents(ui_web_contents), | 480 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 480 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), | 481 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), |
| 481 for_web_vr, VrShellDelegate::GetNativeDelegate(env, delegate), | 482 for_web_vr, VrShellDelegate::GetNativeDelegate(env, delegate), |
| 482 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 483 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 483 } | 484 } |
| 484 | 485 |
| 485 } // namespace vr_shell | 486 } // namespace vr_shell |
| OLD | NEW |