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

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

Issue 2784303002: Adds button to VRShell menu mode, which lets the user manually exit WebVR presentation. (Closed)
Patch Set: Fixed closure compiler error Created 3 years, 8 months 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_delegate.h" 5 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h" 10 #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 // If/When VRShell is ready for use it will call SetPresentResult. 158 // If/When VRShell is ready for use it will call SetPresentResult.
159 JNIEnv* env = AttachCurrentThread(); 159 JNIEnv* env = AttachCurrentThread();
160 Java_VrShellDelegate_presentRequested(env, j_vr_shell_delegate_.obj()); 160 Java_VrShellDelegate_presentRequested(env, j_vr_shell_delegate_.obj());
161 } 161 }
162 162
163 void VrShellDelegate::ExitWebVRPresent() { 163 void VrShellDelegate::ExitWebVRPresent() {
164 // VRShell is no longer needed by WebVR, allow it to shut down if it's not 164 // VRShell is no longer needed by WebVR, allow it to shut down if it's not
165 // being used elsewhere. 165 // being used elsewhere.
166 JNIEnv* env = AttachCurrentThread(); 166 JNIEnv* env = AttachCurrentThread();
167 Java_VrShellDelegate_exitWebVR(env, j_vr_shell_delegate_.obj()); 167 if (Java_VrShellDelegate_exitWebVRPresent(env, j_vr_shell_delegate_.obj())) {
168 device_provider_->Device()->OnExitPresent();
169 }
168 } 170 }
169 171
170 void VrShellDelegate::CreateNonPresentingDelegate() { 172 void VrShellDelegate::CreateNonPresentingDelegate() {
171 JNIEnv* env = AttachCurrentThread(); 173 JNIEnv* env = AttachCurrentThread();
172 gvr_context* context = reinterpret_cast<gvr_context*>( 174 gvr_context* context = reinterpret_cast<gvr_context*>(
173 Java_VrShellDelegate_createNonPresentingNativeContext( 175 Java_VrShellDelegate_createNonPresentingNativeContext(
174 env, j_vr_shell_delegate_.obj())); 176 env, j_vr_shell_delegate_.obj()));
175 non_presenting_delegate_ = 177 non_presenting_delegate_ =
176 base::MakeUnique<NonPresentingGvrDelegate>(context); 178 base::MakeUnique<NonPresentingGvrDelegate>(context);
177 non_presenting_delegate_->UpdateVSyncInterval(timebase_nanos_, 179 non_presenting_delegate_->UpdateVSyncInterval(timebase_nanos_,
(...skipping 23 matching lines...) Expand all
201 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 203 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
202 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); 204 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj));
203 } 205 }
204 206
205 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) { 207 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
206 device::GvrDelegateProvider::SetInstance( 208 device::GvrDelegateProvider::SetInstance(
207 base::Bind(&VrShellDelegate::CreateVrShellDelegate)); 209 base::Bind(&VrShellDelegate::CreateVrShellDelegate));
208 } 210 }
209 211
210 } // namespace vr_shell 212 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_delegate.h ('k') | chrome/browser/resources/vr_shell/vr_shell_ui.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698