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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 void VrShell::AppButtonGesturePerformed(UiInterface::Direction direction) { | 400 void VrShell::AppButtonGesturePerformed(UiInterface::Direction direction) { |
401 if (vr_shell_enabled_) | 401 if (vr_shell_enabled_) |
402 ui_->HandleAppButtonGesturePerformed(direction); | 402 ui_->HandleAppButtonGesturePerformed(direction); |
403 } | 403 } |
404 | 404 |
405 void VrShell::AppButtonPressed() { | 405 void VrShell::AppButtonPressed() { |
406 if (vr_shell_enabled_) | 406 if (vr_shell_enabled_) |
407 ui_->HandleAppButtonClicked(); | 407 ui_->HandleAppButtonClicked(); |
408 } | 408 } |
409 | 409 |
| 410 void VrShell::OnPhysicalBackingSizeChanged( |
| 411 JNIEnv* env, |
| 412 const JavaParamRef<jobject>& obj, |
| 413 const JavaParamRef<jobject>& jweb_contents, |
| 414 jint width, |
| 415 jint height) { |
| 416 content::WebContents* web_contents = |
| 417 content::WebContents::FromJavaWebContents(jweb_contents); |
| 418 gfx::Size size(width, height); |
| 419 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); |
| 420 } |
| 421 |
410 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, | 422 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, |
411 const JavaParamRef<jobject>& object, | 423 const JavaParamRef<jobject>& object, |
412 jint width, | 424 jint width, |
413 jint height, | 425 jint height, |
414 jfloat dpr) { | 426 jfloat dpr) { |
415 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); | 427 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); |
416 // TODO(acondor): Set the device scale factor for font rendering on the | 428 // TODO(acondor): Set the device scale factor for font rendering on the |
417 // VR Shell textures. | 429 // VR Shell textures. |
418 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, | 430 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, |
419 gl_thread_->GetVrShellGl(), width, | 431 gl_thread_->GetVrShellGl(), width, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 jboolean for_web_vr, | 577 jboolean for_web_vr, |
566 jlong gvr_api, | 578 jlong gvr_api, |
567 jboolean reprojected_rendering) { | 579 jboolean reprojected_rendering) { |
568 return reinterpret_cast<intptr_t>(new VrShell( | 580 return reinterpret_cast<intptr_t>(new VrShell( |
569 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), | 581 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), |
570 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 582 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
571 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 583 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
572 } | 584 } |
573 | 585 |
574 } // namespace vr_shell | 586 } // namespace vr_shell |
OLD | NEW |