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

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

Issue 2874103003: Revert 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 if (device_provider_) { 194 device_provider_->Device()->OnExitPresent();
195 device_provider_->Device()->OnExitPresent();
196 }
197 } 195 }
198 } 196 }
199 197
200 void VrShellDelegate::CreateNonPresentingDelegate() { 198 void VrShellDelegate::CreateNonPresentingDelegate() {
201 JNIEnv* env = AttachCurrentThread(); 199 JNIEnv* env = AttachCurrentThread();
202 gvr_context* context = reinterpret_cast<gvr_context*>( 200 gvr_context* context = reinterpret_cast<gvr_context*>(
203 Java_VrShellDelegate_createNonPresentingNativeContext( 201 Java_VrShellDelegate_createNonPresentingNativeContext(
204 env, j_vr_shell_delegate_.obj())); 202 env, j_vr_shell_delegate_.obj()));
205 non_presenting_delegate_ = 203 non_presenting_delegate_ =
206 base::MakeUnique<NonPresentingGvrDelegate>(context); 204 base::MakeUnique<NonPresentingGvrDelegate>(context);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 237 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
240 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); 238 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj));
241 } 239 }
242 240
243 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) { 241 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
244 device::GvrDelegateProvider::SetInstance( 242 device::GvrDelegateProvider::SetInstance(
245 base::Bind(&VrShellDelegate::CreateVrShellDelegate)); 243 base::Bind(&VrShellDelegate::CreateVrShellDelegate));
246 } 244 }
247 245
248 } // namespace vr_shell 246 } // 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