| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/android/vr_shell/vr_controller_model.h" | 27 #include "chrome/browser/android/vr_shell/vr_controller_model.h" |
| 28 #include "chrome/browser/android/vr_shell/vr_gl_thread.h" | 28 #include "chrome/browser/android/vr_shell/vr_gl_thread.h" |
| 29 #include "chrome/browser/android/vr_shell/vr_input_manager.h" | 29 #include "chrome/browser/android/vr_shell/vr_input_manager.h" |
| 30 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" | 30 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" |
| 31 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 31 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 32 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" | 32 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" |
| 33 #include "chrome/browser/android/vr_shell/vr_usage_monitor.h" | 33 #include "chrome/browser/android/vr_shell/vr_usage_monitor.h" |
| 34 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" | 34 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" |
| 35 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 35 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 36 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" | 36 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" |
| 37 #include "content/public/browser/browser_context.h" |
| 37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 38 #include "content/public/browser/navigation_controller.h" | 39 #include "content/public/browser/navigation_controller.h" |
| 39 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
| 40 #include "content/public/browser/render_widget_host.h" | 41 #include "content/public/browser/render_widget_host.h" |
| 41 #include "content/public/browser/render_widget_host_iterator.h" | 42 #include "content/public/browser/render_widget_host_iterator.h" |
| 42 #include "content/public/browser/render_widget_host_view.h" | 43 #include "content/public/browser/render_widget_host_view.h" |
| 43 #include "content/public/browser/web_contents.h" | 44 #include "content/public/browser/web_contents.h" |
| 44 #include "content/public/common/content_features.h" | 45 #include "content/public/common/content_features.h" |
| 45 #include "content/public/common/referrer.h" | 46 #include "content/public/common/referrer.h" |
| 46 #include "device/vr/android/gvr/cardboard_gamepad_data_fetcher.h" | 47 #include "device/vr/android/gvr/cardboard_gamepad_data_fetcher.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 metrics_helper_->SetVRActive(true); | 162 metrics_helper_->SetVRActive(true); |
| 162 metrics_helper_->SetWebVREnabled(webvr_mode_); | 163 metrics_helper_->SetWebVREnabled(webvr_mode_); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void VrShell::SetUiState() { | 166 void VrShell::SetUiState() { |
| 166 if (!web_contents_) { | 167 if (!web_contents_) { |
| 167 // TODO(mthiesse): Properly handle native page URLs. | 168 // TODO(mthiesse): Properly handle native page URLs. |
| 168 ui_->SetURL(GURL()); | 169 ui_->SetURL(GURL()); |
| 169 ui_->SetLoading(false); | 170 ui_->SetLoading(false); |
| 170 ui_->SetFullscreen(false); | 171 ui_->SetFullscreen(false); |
| 171 ui_->SetURL(GURL()); | 172 ui_->SetIncognito(false); |
| 172 } else { | 173 } else { |
| 173 ui_->SetURL(web_contents_->GetVisibleURL()); | 174 ui_->SetURL(web_contents_->GetVisibleURL()); |
| 174 ui_->SetLoading(web_contents_->IsLoading()); | 175 ui_->SetLoading(web_contents_->IsLoading()); |
| 175 ui_->SetFullscreen(web_contents_->IsFullscreen()); | 176 ui_->SetFullscreen(web_contents_->IsFullscreen()); |
| 177 ui_->SetIncognito(web_contents_->GetBrowserContext()->IsOffTheRecord()); |
| 176 } | 178 } |
| 177 } | 179 } |
| 178 | 180 |
| 179 bool RegisterVrShell(JNIEnv* env) { | 181 bool RegisterVrShell(JNIEnv* env) { |
| 180 return RegisterNativesImpl(env); | 182 return RegisterNativesImpl(env); |
| 181 } | 183 } |
| 182 | 184 |
| 183 VrShell::~VrShell() { | 185 VrShell::~VrShell() { |
| 184 DVLOG(1) << __FUNCTION__ << "=" << this; | 186 DVLOG(1) << __FUNCTION__ << "=" << this; |
| 185 poll_capturing_media_task_.Cancel(); | 187 poll_capturing_media_task_.Cancel(); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 jlong gvr_api, | 715 jlong gvr_api, |
| 714 jboolean reprojected_rendering) { | 716 jboolean reprojected_rendering) { |
| 715 return reinterpret_cast<intptr_t>(new VrShell( | 717 return reinterpret_cast<intptr_t>(new VrShell( |
| 716 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), | 718 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 717 for_web_vr, in_cct, | 719 for_web_vr, in_cct, |
| 718 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 720 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
| 719 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 721 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 720 } | 722 } |
| 721 | 723 |
| 722 } // namespace vr_shell | 724 } // namespace vr_shell |
| OLD | NEW |