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

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

Issue 2876743002: Reland of App button click exits WebVR presentation. (Closed)
Patch Set: Created 3 years, 7 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 "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // If/When VRShell is ready for use it will call SetPresentResult. 184 // If/When VRShell is ready for use it will call SetPresentResult.
185 JNIEnv* env = AttachCurrentThread(); 185 JNIEnv* env = AttachCurrentThread();
186 Java_VrShellDelegate_presentRequested(env, j_vr_shell_delegate_.obj()); 186 Java_VrShellDelegate_presentRequested(env, j_vr_shell_delegate_.obj());
187 } 187 }
188 188
189 void VrShellDelegate::ExitWebVRPresent() { 189 void VrShellDelegate::ExitWebVRPresent() {
190 // VRShell is no longer needed by WebVR, allow it to shut down if it's not 190 // VRShell is no longer needed by WebVR, allow it to shut down if it's not
191 // being used elsewhere. 191 // being used elsewhere.
192 JNIEnv* env = AttachCurrentThread(); 192 JNIEnv* env = AttachCurrentThread();
193 if (Java_VrShellDelegate_exitWebVRPresent(env, j_vr_shell_delegate_.obj())) { 193 if (Java_VrShellDelegate_exitWebVRPresent(env, j_vr_shell_delegate_.obj())) {
194 device_provider_->Device()->OnExitPresent(); 194 if (device_provider_) {
195 device_provider_->Device()->OnExitPresent();
196 }
195 } 197 }
196 } 198 }
197 199
198 void VrShellDelegate::CreateNonPresentingDelegate() { 200 void VrShellDelegate::CreateNonPresentingDelegate() {
199 JNIEnv* env = AttachCurrentThread(); 201 JNIEnv* env = AttachCurrentThread();
200 gvr_context* context = reinterpret_cast<gvr_context*>( 202 gvr_context* context = reinterpret_cast<gvr_context*>(
201 Java_VrShellDelegate_createNonPresentingNativeContext( 203 Java_VrShellDelegate_createNonPresentingNativeContext(
202 env, j_vr_shell_delegate_.obj())); 204 env, j_vr_shell_delegate_.obj()));
203 non_presenting_delegate_ = 205 non_presenting_delegate_ =
204 base::MakeUnique<NonPresentingGvrDelegate>(context); 206 base::MakeUnique<NonPresentingGvrDelegate>(context);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 239 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
238 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); 240 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj));
239 } 241 }
240 242
241 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) { 243 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
242 device::GvrDelegateProvider::SetInstance( 244 device::GvrDelegateProvider::SetInstance(
243 base::Bind(&VrShellDelegate::CreateVrShellDelegate)); 245 base::Bind(&VrShellDelegate::CreateVrShellDelegate));
244 } 246 }
245 247
246 } // namespace vr_shell 248 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | chrome/browser/android/vr_shell/vr_shell_gl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698