| 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 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/android/vr_shell/vr_input_manager.h" | 24 #include "chrome/browser/android/vr_shell/vr_input_manager.h" |
| 25 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" | 25 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" |
| 26 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 26 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 27 #include "chrome/browser/android/vr_shell/vr_usage_monitor.h" | 27 #include "chrome/browser/android/vr_shell/vr_usage_monitor.h" |
| 28 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" | 28 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" |
| 29 #include "content/public/browser/navigation_controller.h" | 29 #include "content/public/browser/navigation_controller.h" |
| 30 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
| 31 #include "content/public/browser/render_widget_host.h" | 31 #include "content/public/browser/render_widget_host.h" |
| 32 #include "content/public/browser/render_widget_host_view.h" | 32 #include "content/public/browser/render_widget_host_view.h" |
| 33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 34 #include "content/public/common/content_features.h" |
| 34 #include "content/public/common/referrer.h" | 35 #include "content/public/common/referrer.h" |
| 35 #include "device/vr/android/gvr/gvr_device.h" | 36 #include "device/vr/android/gvr/gvr_device.h" |
| 36 #include "device/vr/android/gvr/gvr_device_provider.h" | 37 #include "device/vr/android/gvr/gvr_device_provider.h" |
| 37 #include "jni/VrShellImpl_jni.h" | 38 #include "jni/VrShellImpl_jni.h" |
| 38 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 39 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 39 #include "ui/android/view_android.h" | 40 #include "ui/android/view_android.h" |
| 40 #include "ui/android/window_android.h" | 41 #include "ui/android/window_android.h" |
| 41 #include "ui/base/page_transition_types.h" | 42 #include "ui/base/page_transition_types.h" |
| 42 #include "ui/display/display.h" | 43 #include "ui/display/display.h" |
| 43 #include "ui/display/screen.h" | 44 #include "ui/display/screen.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 jobject obj, | 66 jobject obj, |
| 66 content::WebContents* main_contents, | 67 content::WebContents* main_contents, |
| 67 ui::WindowAndroid* content_window, | 68 ui::WindowAndroid* content_window, |
| 68 content::WebContents* ui_contents, | 69 content::WebContents* ui_contents, |
| 69 ui::WindowAndroid* ui_window, | 70 ui::WindowAndroid* ui_window, |
| 70 bool for_web_vr, | 71 bool for_web_vr, |
| 71 VrShellDelegate* delegate, | 72 VrShellDelegate* delegate, |
| 72 gvr_context* gvr_api, | 73 gvr_context* gvr_api, |
| 73 bool reprojected_rendering) | 74 bool reprojected_rendering) |
| 74 : WebContentsObserver(ui_contents), | 75 : WebContentsObserver(ui_contents), |
| 76 vr_shell_enabled_(base::FeatureList::IsEnabled(features::kVrShell)), |
| 75 main_contents_(main_contents), | 77 main_contents_(main_contents), |
| 76 content_compositor_( | 78 content_compositor_( |
| 77 base::MakeUnique<VrCompositor>(content_window, false)), | 79 base::MakeUnique<VrCompositor>(content_window, false)), |
| 78 ui_contents_(ui_contents), | 80 ui_contents_(ui_contents), |
| 79 ui_compositor_(base::MakeUnique<VrCompositor>(ui_window, true)), | 81 ui_compositor_(base::MakeUnique<VrCompositor>(ui_window, true)), |
| 80 delegate_provider_(delegate), | 82 delegate_provider_(delegate), |
| 81 metrics_helper_(base::MakeUnique<VrMetricsHelper>(main_contents_)), | 83 metrics_helper_(base::MakeUnique<VrMetricsHelper>(main_contents_)), |
| 82 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 84 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 83 reprojected_rendering_(reprojected_rendering), | 85 reprojected_rendering_(reprojected_rendering), |
| 84 gvr_api_(gvr_api), | 86 gvr_api_(gvr_api), |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 void VrShell::SurfacesChanged(jobject content_surface, jobject ui_surface) { | 329 void VrShell::SurfacesChanged(jobject content_surface, jobject ui_surface) { |
| 328 content_compositor_->SurfaceChanged(content_surface); | 330 content_compositor_->SurfaceChanged(content_surface); |
| 329 ui_compositor_->SurfaceChanged(ui_surface); | 331 ui_compositor_->SurfaceChanged(ui_surface); |
| 330 } | 332 } |
| 331 | 333 |
| 332 void VrShell::GvrDelegateReady() { | 334 void VrShell::GvrDelegateReady() { |
| 333 delegate_provider_->SetDelegate(this, gvr_api_); | 335 delegate_provider_->SetDelegate(this, gvr_api_); |
| 334 } | 336 } |
| 335 | 337 |
| 336 void VrShell::AppButtonPressed() { | 338 void VrShell::AppButtonPressed() { |
| 337 #if defined(ENABLE_VR_SHELL) | 339 if (vr_shell_enabled_) |
| 338 html_interface_->HandleAppButtonClicked(); | 340 html_interface_->HandleAppButtonClicked(); |
| 339 #endif | |
| 340 } | 341 } |
| 341 | 342 |
| 342 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, | 343 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, |
| 343 const JavaParamRef<jobject>& object, | 344 const JavaParamRef<jobject>& object, |
| 344 jint width, jint height, | 345 jint width, jint height, |
| 345 jfloat dpr) { | 346 jfloat dpr) { |
| 346 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); | 347 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); |
| 347 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, | 348 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, |
| 348 gl_thread_->GetVrShellGl(), width, | 349 gl_thread_->GetVrShellGl(), width, |
| 349 height)); | 350 height)); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 return reinterpret_cast<intptr_t>(new VrShell( | 605 return reinterpret_cast<intptr_t>(new VrShell( |
| 605 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 606 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
| 606 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 607 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 607 content::WebContents::FromJavaWebContents(ui_web_contents), | 608 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 608 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), | 609 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), |
| 609 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 610 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
| 610 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 611 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 611 } | 612 } |
| 612 | 613 |
| 613 } // namespace vr_shell | 614 } // namespace vr_shell |
| OLD | NEW |