| 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 <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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 non_presenting_delegate_->Pause(); | 135 non_presenting_delegate_->Pause(); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 void VrShellDelegate::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 139 void VrShellDelegate::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 140 if (non_presenting_delegate_) { | 140 if (non_presenting_delegate_) { |
| 141 non_presenting_delegate_->Resume(); | 141 non_presenting_delegate_->Resume(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 void VrShellDelegate::UpdateNonPresentingContext( |
| 146 JNIEnv* env, |
| 147 const JavaParamRef<jobject>& obj, |
| 148 jlong context) { |
| 149 gvr_context* ctx = reinterpret_cast<gvr_context*>(context); |
| 150 non_presenting_delegate_->UpdateContext(ctx); |
| 151 } |
| 152 |
| 145 void VrShellDelegate::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 153 void VrShellDelegate::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 146 delete this; | 154 delete this; |
| 147 } | 155 } |
| 148 | 156 |
| 149 void VrShellDelegate::SetDeviceProvider( | 157 void VrShellDelegate::SetDeviceProvider( |
| 150 device::GvrDeviceProvider* device_provider) { | 158 device::GvrDeviceProvider* device_provider) { |
| 151 if (device_provider_ == device_provider) | 159 if (device_provider_ == device_provider) |
| 152 return; | 160 return; |
| 153 if (device_provider_) | 161 if (device_provider_) |
| 154 ClearDeviceProvider(); | 162 ClearDeviceProvider(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 247 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 240 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); | 248 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); |
| 241 } | 249 } |
| 242 | 250 |
| 243 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 251 static void OnLibraryAvailable(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 244 device::GvrDelegateProvider::SetInstance( | 252 device::GvrDelegateProvider::SetInstance( |
| 245 base::Bind(&VrShellDelegate::CreateVrShellDelegate)); | 253 base::Bind(&VrShellDelegate::CreateVrShellDelegate)); |
| 246 } | 254 } |
| 247 | 255 |
| 248 } // namespace vr_shell | 256 } // namespace vr_shell |
| OLD | NEW |