| 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> |
| 11 | 11 |
| 12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/android/tab_android.h" | 22 #include "chrome/browser/android/tab_android.h" |
| 23 #include "chrome/browser/android/vr_shell/android_ui_gesture_target.h" | 23 #include "chrome/browser/android/vr_shell/android_ui_gesture_target.h" |
| 24 #include "chrome/browser/android/vr_shell/vr_compositor.h" | 24 #include "chrome/browser/android/vr_shell/vr_compositor.h" |
| 25 #include "chrome/browser/android/vr_shell/vr_controller_model.h" | 25 #include "chrome/browser/android/vr_shell/vr_controller_model.h" |
| 26 #include "chrome/browser/android/vr_shell/vr_gl_thread.h" | 26 #include "chrome/browser/android/vr_shell/vr_gl_thread.h" |
| 27 #include "chrome/browser/android/vr_shell/vr_input_manager.h" | 27 #include "chrome/browser/android/vr_shell/vr_input_manager.h" |
| 28 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" | 28 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" |
| 29 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 29 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 30 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" | |
| 31 #include "chrome/browser/android/vr_shell/vr_usage_monitor.h" | 30 #include "chrome/browser/android/vr_shell/vr_usage_monitor.h" |
| 32 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" | 31 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" |
| 33 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 32 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 34 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" | 33 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" |
| 35 #include "chrome/browser/vr/toolbar_helper.h" | 34 #include "chrome/browser/vr/toolbar_helper.h" |
| 36 #include "chrome/browser/vr/ui_interface.h" | 35 #include "chrome/browser/vr/ui_interface.h" |
| 37 #include "chrome/browser/vr/ui_scene_manager.h" | 36 #include "chrome/browser/vr/ui_scene_manager.h" |
| 37 #include "chrome/browser/vr/vr_tab_helper.h" |
| 38 #include "content/public/browser/browser_context.h" | 38 #include "content/public/browser/browser_context.h" |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/navigation_controller.h" | 40 #include "content/public/browser/navigation_controller.h" |
| 41 #include "content/public/browser/render_view_host.h" | 41 #include "content/public/browser/render_view_host.h" |
| 42 #include "content/public/browser/render_widget_host.h" | 42 #include "content/public/browser/render_widget_host.h" |
| 43 #include "content/public/browser/render_widget_host_iterator.h" | 43 #include "content/public/browser/render_widget_host_iterator.h" |
| 44 #include "content/public/browser/render_widget_host_view.h" | 44 #include "content/public/browser/render_widget_host_view.h" |
| 45 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
| 46 #include "content/public/common/content_features.h" | 46 #include "content/public/common/content_features.h" |
| 47 #include "content/public/common/referrer.h" | 47 #include "content/public/common/referrer.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 77 constexpr base::TimeDelta kExitVrDueToUnsupportedModeDelay = | 77 constexpr base::TimeDelta kExitVrDueToUnsupportedModeDelay = |
| 78 base::TimeDelta::FromSeconds(5); | 78 base::TimeDelta::FromSeconds(5); |
| 79 | 79 |
| 80 void SetIsInVR(content::WebContents* contents, bool is_in_vr) { | 80 void SetIsInVR(content::WebContents* contents, bool is_in_vr) { |
| 81 if (contents && contents->GetRenderWidgetHostView()) { | 81 if (contents && contents->GetRenderWidgetHostView()) { |
| 82 // TODO(asimjour) Contents should not be aware of VR mode. Instead, we | 82 // TODO(asimjour) Contents should not be aware of VR mode. Instead, we |
| 83 // should add a flag for disabling specific UI such as the keyboard (see | 83 // should add a flag for disabling specific UI such as the keyboard (see |
| 84 // VrTabHelper for details). | 84 // VrTabHelper for details). |
| 85 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr); | 85 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr); |
| 86 | 86 |
| 87 VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents); | 87 vr::VrTabHelper* vr_tab_helper = vr::VrTabHelper::FromWebContents(contents); |
| 88 DCHECK(vr_tab_helper); | 88 DCHECK(vr_tab_helper); |
| 89 vr_tab_helper->SetIsInVr(is_in_vr); | 89 vr_tab_helper->SetIsInVr(is_in_vr); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| 94 | 94 |
| 95 VrShell::VrShell(JNIEnv* env, | 95 VrShell::VrShell(JNIEnv* env, |
| 96 jobject obj, | 96 jobject obj, |
| 97 ui::WindowAndroid* window, | 97 ui::WindowAndroid* window, |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 jlong gvr_api, | 733 jlong gvr_api, |
| 734 jboolean reprojected_rendering) { | 734 jboolean reprojected_rendering) { |
| 735 return reinterpret_cast<intptr_t>(new VrShell( | 735 return reinterpret_cast<intptr_t>(new VrShell( |
| 736 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), | 736 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 737 for_web_vr, web_vr_autopresentation_expected, in_cct, | 737 for_web_vr, web_vr_autopresentation_expected, in_cct, |
| 738 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 738 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
| 739 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 739 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 740 } | 740 } |
| 741 | 741 |
| 742 } // namespace vr_shell | 742 } // namespace vr_shell |
| OLD | NEW |