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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 content_surface_ = surface; | 393 content_surface_ = surface; |
394 compositor_->SurfaceChanged(surface); | 394 compositor_->SurfaceChanged(surface); |
395 JNIEnv* env = base::android::AttachCurrentThread(); | 395 JNIEnv* env = base::android::AttachCurrentThread(); |
396 Java_VrShellImpl_contentSurfaceChanged(env, j_vr_shell_.obj()); | 396 Java_VrShellImpl_contentSurfaceChanged(env, j_vr_shell_.obj()); |
397 } | 397 } |
398 | 398 |
399 void VrShell::GvrDelegateReady() { | 399 void VrShell::GvrDelegateReady() { |
400 delegate_provider_->SetPresentingDelegate(this, gvr_api_); | 400 delegate_provider_->SetPresentingDelegate(this, gvr_api_); |
401 } | 401 } |
402 | 402 |
| 403 void VrShell::OnPhysicalBackingSizeChanged( |
| 404 JNIEnv* env, |
| 405 const JavaParamRef<jobject>& obj, |
| 406 const JavaParamRef<jobject>& jweb_contents, |
| 407 jint width, |
| 408 jint height) { |
| 409 content::WebContents* web_contents = |
| 410 content::WebContents::FromJavaWebContents(jweb_contents); |
| 411 gfx::Size size(width, height); |
| 412 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); |
| 413 } |
| 414 |
403 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, | 415 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, |
404 const JavaParamRef<jobject>& object, | 416 const JavaParamRef<jobject>& object, |
405 jint width, | 417 jint width, |
406 jint height, | 418 jint height, |
407 jfloat dpr) { | 419 jfloat dpr) { |
408 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); | 420 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); |
409 // TODO(acondor): Set the device scale factor for font rendering on the | 421 // TODO(acondor): Set the device scale factor for font rendering on the |
410 // VR Shell textures. | 422 // VR Shell textures. |
411 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, | 423 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, |
412 gl_thread_->GetVrShellGl(), width, | 424 gl_thread_->GetVrShellGl(), width, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 jlong gvr_api, | 568 jlong gvr_api, |
557 jboolean reprojected_rendering) { | 569 jboolean reprojected_rendering) { |
558 return reinterpret_cast<intptr_t>(new VrShell( | 570 return reinterpret_cast<intptr_t>(new VrShell( |
559 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), | 571 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), |
560 for_web_vr, in_cct, | 572 for_web_vr, in_cct, |
561 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 573 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
562 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 574 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
563 } | 575 } |
564 | 576 |
565 } // namespace vr_shell | 577 } // namespace vr_shell |
OLD | NEW |