| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 if (html_interface_->GetMenuMode()) { | 333 if (html_interface_->GetMenuMode()) { |
| 334 delegate_->device_provider()->OnDisplayBlur(); | 334 delegate_->device_provider()->OnDisplayBlur(); |
| 335 } else { | 335 } else { |
| 336 delegate_->device_provider()->OnDisplayFocus(); | 336 delegate_->device_provider()->OnDisplayFocus(); |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 #endif | 340 #endif |
| 341 } | 341 } |
| 342 | 342 |
| 343 void VrShell::ContentBoundsChanged(JNIEnv* env, | 343 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, |
| 344 const JavaParamRef<jobject>& object, | 344 const JavaParamRef<jobject>& object, |
| 345 jint width, jint height, jfloat dpr) { | 345 jint width, jint height, |
| 346 TRACE_EVENT0("gpu", "VrShell::ContentBoundsChanged"); | 346 jfloat dpr) { |
| 347 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); |
| 347 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); | 348 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); |
| 348 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, | 349 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, |
| 349 thread->GetVrShellGl(), width, height)); | 350 thread->GetVrShellGl(), width, height)); |
| 350 content_compositor_->SetWindowBounds(gfx::Size(width, height)); | 351 content_compositor_->SetWindowBounds(gfx::Size(width, height)); |
| 351 } | 352 } |
| 352 | 353 |
| 353 void VrShell::UIBoundsChanged(JNIEnv* env, | 354 void VrShell::UIPhysicalBoundsChanged(JNIEnv* env, |
| 354 const JavaParamRef<jobject>& object, | 355 const JavaParamRef<jobject>& object, |
| 355 jint width, jint height, jfloat dpr) { | 356 jint width, jint height, jfloat dpr) { |
| 356 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); | 357 GLThread* thread = static_cast<GLThread*>(gl_thread_.get()); |
| 357 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UIPhysicalBoundsChanged, | 358 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UIPhysicalBoundsChanged, |
| 358 thread->GetVrShellGl(), width, height)); | 359 thread->GetVrShellGl(), width, height)); |
| 359 ui_compositor_->SetWindowBounds(gfx::Size(width, height)); | 360 ui_compositor_->SetWindowBounds(gfx::Size(width, height)); |
| 360 } | 361 } |
| 361 | 362 |
| 362 UiInterface* VrShell::GetUiInterface() { | 363 UiInterface* VrShell::GetUiInterface() { |
| 363 return html_interface_.get(); | 364 return html_interface_.get(); |
| 364 } | 365 } |
| 365 | 366 |
| (...skipping 110 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 |