| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); | 261 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); |
| 262 PostToGlThreadWhenReady( | 262 PostToGlThreadWhenReady( |
| 263 base::Bind(&VrShellGl::SetWebVrMode, thread->GetVrShellGl(), enabled)); | 263 base::Bind(&VrShellGl::SetWebVrMode, thread->GetVrShellGl(), enabled)); |
| 264 if (enabled) { | 264 if (enabled) { |
| 265 html_interface_->SetMode(UiInterface::Mode::WEB_VR); | 265 html_interface_->SetMode(UiInterface::Mode::WEB_VR); |
| 266 } else { | 266 } else { |
| 267 html_interface_->SetMode(UiInterface::Mode::STANDARD); | 267 html_interface_->SetMode(UiInterface::Mode::STANDARD); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 void VrShell::OnLoadProgressChanged( |
| 272 JNIEnv* env, |
| 273 const base::android::JavaParamRef<jobject>& obj, |
| 274 double progress) { |
| 275 html_interface_->SetLoadProgress(progress); |
| 276 } |
| 277 |
| 271 void VrShell::SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) { | 278 void VrShell::SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) { |
| 272 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); | 279 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); |
| 273 if (thread->IsRunning()) { | 280 if (thread->IsRunning()) { |
| 274 thread->task_runner()->PostTask( | 281 thread->task_runner()->PostTask( |
| 275 FROM_HERE, base::Bind(&VrShellGl::SetGvrPoseForWebVr, | 282 FROM_HERE, base::Bind(&VrShellGl::SetGvrPoseForWebVr, |
| 276 thread->GetVrShellGl(), pose, pose_num)); | 283 thread->GetVrShellGl(), pose, pose_num)); |
| 277 } | 284 } |
| 278 } | 285 } |
| 279 | 286 |
| 280 void VrShell::SetWebVRRenderSurfaceSize(int width, int height) { | 287 void VrShell::SetWebVRRenderSurfaceSize(int width, int height) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 return reinterpret_cast<intptr_t>(new VrShell( | 483 return reinterpret_cast<intptr_t>(new VrShell( |
| 477 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 484 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
| 478 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 485 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 479 content::WebContents::FromJavaWebContents(ui_web_contents), | 486 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 480 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), | 487 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), |
| 481 for_web_vr, VrShellDelegate::GetNativeDelegate(env, delegate), | 488 for_web_vr, VrShellDelegate::GetNativeDelegate(env, delegate), |
| 482 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 489 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 483 } | 490 } |
| 484 | 491 |
| 485 } // namespace vr_shell | 492 } // namespace vr_shell |
| OLD | NEW |