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 "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "chrome/browser/android/vr_shell/ui_elements.h" | 8 #include "chrome/browser/android/vr_shell/ui_elements.h" |
9 #include "chrome/browser/android/vr_shell/ui_interface.h" | 9 #include "chrome/browser/android/vr_shell/ui_interface.h" |
10 #include "chrome/browser/android/vr_shell/ui_scene.h" | 10 #include "chrome/browser/android/vr_shell/ui_scene.h" |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } | 755 } |
756 | 756 |
757 void VrShell::SetWebVrMode(JNIEnv* env, | 757 void VrShell::SetWebVrMode(JNIEnv* env, |
758 const base::android::JavaParamRef<jobject>& obj, | 758 const base::android::JavaParamRef<jobject>& obj, |
759 bool enabled) { | 759 bool enabled) { |
760 webvr_mode_ = enabled; | 760 webvr_mode_ = enabled; |
761 if (enabled) { | 761 if (enabled) { |
762 int64_t now = gvr::GvrApi::GetTimePointNow().monotonic_system_time_nanos; | 762 int64_t now = gvr::GvrApi::GetTimePointNow().monotonic_system_time_nanos; |
763 constexpr int64_t seconds_to_nanos = 1000 * 1000 * 1000; | 763 constexpr int64_t seconds_to_nanos = 1000 * 1000 * 1000; |
764 webvr_warning_end_nanos_ = now + kWebVrWarningSeconds * seconds_to_nanos; | 764 webvr_warning_end_nanos_ = now + kWebVrWarningSeconds * seconds_to_nanos; |
| 765 html_interface_->SetMode(UiInterface::Mode::WEB_VR); |
765 } else { | 766 } else { |
766 webvr_warning_end_nanos_ = 0; | 767 webvr_warning_end_nanos_ = 0; |
| 768 html_interface_->SetMode(UiInterface::Mode::STANDARD); |
767 } | 769 } |
768 } | 770 } |
769 | 771 |
770 void VrShell::SetWebVRSecureOrigin(bool secure_origin) { | 772 void VrShell::SetWebVRSecureOrigin(bool secure_origin) { |
771 webvr_secure_origin_ = secure_origin; | 773 webvr_secure_origin_ = secure_origin; |
772 } | 774 } |
773 | 775 |
774 void VrShell::SubmitWebVRFrame() { | 776 void VrShell::SubmitWebVRFrame() { |
775 } | 777 } |
776 | 778 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 const JavaParamRef<jobject>& ui_web_contents, | 876 const JavaParamRef<jobject>& ui_web_contents, |
875 jlong ui_window_android) { | 877 jlong ui_window_android) { |
876 return reinterpret_cast<intptr_t>(new VrShell( | 878 return reinterpret_cast<intptr_t>(new VrShell( |
877 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 879 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
878 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 880 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
879 content::WebContents::FromJavaWebContents(ui_web_contents), | 881 content::WebContents::FromJavaWebContents(ui_web_contents), |
880 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); | 882 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); |
881 } | 883 } |
882 | 884 |
883 } // namespace vr_shell | 885 } // namespace vr_shell |
OLD | NEW |