| 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 "device/vr/android/gvr/gvr_device_provider.h" | 5 #include "device/vr/android/gvr/gvr_device_provider.h" |
| 6 | 6 |
| 7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_utils.h" | 9 #include "base/android/jni_utils.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 Java_GvrDeviceProvider_getNativeContext(env, j_device_.obj()); | 51 Java_GvrDeviceProvider_getNativeContext(env, j_device_.obj()); |
| 52 | 52 |
| 53 if (!gvr_api) | 53 if (!gvr_api) |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 GvrApiManager::GetInstance()->Initialize( | 56 GvrApiManager::GetInstance()->Initialize( |
| 57 reinterpret_cast<gvr_context*>(gvr_api)); | 57 reinterpret_cast<gvr_context*>(gvr_api)); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 void GvrDeviceProvider::SetClient(VRClientDispatcher* client) { |
| 62 if (!vr_device_) |
| 63 return; |
| 64 vr_device_->SetClient(client); |
| 65 } |
| 66 |
| 61 void GvrDeviceProvider::OnGvrApiInitialized(gvr::GvrApi* gvr_api) { | 67 void GvrDeviceProvider::OnGvrApiInitialized(gvr::GvrApi* gvr_api) { |
| 62 if (!vr_device_) | 68 if (!vr_device_) |
| 63 vr_device_.reset(new GvrDevice(this, gvr_api)); | 69 vr_device_.reset(new GvrDevice(this, gvr_api)); |
| 64 | 70 |
| 65 // Should fire a vrdisplayconnected event here. | 71 // Should fire a vrdisplayconnected event here. |
| 66 } | 72 } |
| 67 | 73 |
| 68 void GvrDeviceProvider::OnGvrApiShutdown() { | 74 void GvrDeviceProvider::OnGvrApiShutdown() { |
| 69 // Nothing to do here just yet. Eventually want to shut down the VRDevice | 75 // Nothing to do here just yet. Eventually want to shut down the VRDevice |
| 70 } | 76 } |
| 71 | 77 |
| 78 void GvrDeviceProvider::PollEvents() { |
| 79 if (vr_device_) |
| 80 vr_device_->PollEvents(); |
| 81 } |
| 82 |
| 72 } // namespace device | 83 } // namespace device |
| OLD | NEW |