Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell.cc

Issue 2542293002: Exit VR when our main content tab is hidden (Usually due to links opening in new tab) (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 delegate_->ForceExitVr(); 1107 delegate_->ForceExitVr();
1108 } 1108 }
1109 1109
1110 void VrShell::ContentWebContentsDestroyed() { 1110 void VrShell::ContentWebContentsDestroyed() {
1111 content_input_manager_.reset(); 1111 content_input_manager_.reset();
1112 main_contents_ = nullptr; 1112 main_contents_ = nullptr;
1113 // TODO(mthiesse): Handle web contents being destroyed. 1113 // TODO(mthiesse): Handle web contents being destroyed.
1114 delegate_->ForceExitVr(); 1114 delegate_->ForceExitVr();
1115 } 1115 }
1116 1116
1117 void VrShell::ContentWasHidden() {
1118 // Ensure we don't continue sending input to it.
1119 content_input_manager_.reset();
1120 // TODO(mthiesse): Handle web contents being hidden.
1121 delegate_->ForceExitVr();
1122 }
1123
1117 void VrShell::SetContentCssSize(float width, float height, float dpr) { 1124 void VrShell::SetContentCssSize(float width, float height, float dpr) {
1118 JNIEnv* env = base::android::AttachCurrentThread(); 1125 JNIEnv* env = base::android::AttachCurrentThread();
1119 Java_VrShellImpl_setContentCssSize(env, j_vr_shell_.obj(), width, height, 1126 Java_VrShellImpl_setContentCssSize(env, j_vr_shell_.obj(), width, height,
1120 dpr); 1127 dpr);
1121 } 1128 }
1122 1129
1123 void VrShell::SetUiCssSize(float width, float height, float dpr) { 1130 void VrShell::SetUiCssSize(float width, float height, float dpr) {
1124 JNIEnv* env = base::android::AttachCurrentThread(); 1131 JNIEnv* env = base::android::AttachCurrentThread();
1125 Java_VrShellImpl_setUiCssSize(env, j_vr_shell_.obj(), width, height, dpr); 1132 Java_VrShellImpl_setUiCssSize(env, j_vr_shell_.obj(), width, height, dpr);
1126 } 1133 }
(...skipping 11 matching lines...) Expand all
1138 jboolean for_web_vr) { 1145 jboolean for_web_vr) {
1139 return reinterpret_cast<intptr_t>(new VrShell( 1146 return reinterpret_cast<intptr_t>(new VrShell(
1140 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), 1147 env, obj, content::WebContents::FromJavaWebContents(content_web_contents),
1141 reinterpret_cast<ui::WindowAndroid*>(content_window_android), 1148 reinterpret_cast<ui::WindowAndroid*>(content_window_android),
1142 content::WebContents::FromJavaWebContents(ui_web_contents), 1149 content::WebContents::FromJavaWebContents(ui_web_contents),
1143 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), 1150 reinterpret_cast<ui::WindowAndroid*>(ui_window_android),
1144 for_web_vr)); 1151 for_web_vr));
1145 } 1152 }
1146 1153
1147 } // namespace vr_shell 1154 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | chrome/browser/android/vr_shell/vr_web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698