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_delegate.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "chrome/browser/android/vr_shell/vr_shell.h" | 8 #include "chrome/browser/android/vr_shell/vr_shell.h" |
9 #include "device/vr/android/gvr/gvr_device_provider.h" | 9 #include "device/vr/android/gvr/gvr_device_provider.h" |
10 #include "jni/VrShellDelegate_jni.h" | 10 #include "jni/VrShellDelegate_jni.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 void VrShellDelegate::DestroyNonPresentingDelegate() { | 102 void VrShellDelegate::DestroyNonPresentingDelegate() { |
103 if (non_presenting_delegate_) { | 103 if (non_presenting_delegate_) { |
104 non_presenting_delegate_.reset(nullptr); | 104 non_presenting_delegate_.reset(nullptr); |
105 JNIEnv* env = AttachCurrentThread(); | 105 JNIEnv* env = AttachCurrentThread(); |
106 Java_VrShellDelegate_shutdownNonPresentingNativeContext( | 106 Java_VrShellDelegate_shutdownNonPresentingNativeContext( |
107 env, j_vr_shell_delegate_.obj()); | 107 env, j_vr_shell_delegate_.obj()); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
| 111 void VrShellDelegate::SetListeningForActivate(bool listening) { |
| 112 JNIEnv* env = AttachCurrentThread(); |
| 113 Java_VrShellDelegate_setListeningForWebVrActivate( |
| 114 env, j_vr_shell_delegate_.obj(), listening); |
| 115 } |
| 116 |
111 // ---------------------------------------------------------------------------- | 117 // ---------------------------------------------------------------------------- |
112 // Native JNI methods | 118 // Native JNI methods |
113 // ---------------------------------------------------------------------------- | 119 // ---------------------------------------------------------------------------- |
114 | 120 |
115 bool RegisterVrShellDelegate(JNIEnv* env) { | 121 bool RegisterVrShellDelegate(JNIEnv* env) { |
116 return RegisterNativesImpl(env); | 122 return RegisterNativesImpl(env); |
117 } | 123 } |
118 | 124 |
119 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 125 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
120 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); | 126 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); |
121 } | 127 } |
122 | 128 |
123 } // namespace vr_shell | 129 } // namespace vr_shell |
OLD | NEW |