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

Side by Side Diff: device/vr/android/gvr/gvr_device_provider.cc

Issue 2705653005: Fix WebVR getDevices promise not resolving when VR Services are not compatible. (Closed)
Patch Set: rebase Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "device/vr/android/gvr/gvr_device_provider.h" 5 #include "device/vr/android/gvr/gvr_device_provider.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/context_utils.h" 9 #include "base/android/context_utils.h"
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 16 matching lines...) Expand all
27 device::GvrDelegateProvider* delegate_provider = 27 device::GvrDelegateProvider* delegate_provider =
28 device::GvrDelegateProvider::GetInstance(); 28 device::GvrDelegateProvider::GetInstance();
29 if (delegate_provider) { 29 if (delegate_provider) {
30 delegate_provider->ExitWebVRPresent(); 30 delegate_provider->ExitWebVRPresent();
31 delegate_provider->ClearDeviceProvider(); 31 delegate_provider->ClearDeviceProvider();
32 } 32 }
33 } 33 }
34 34
35 void GvrDeviceProvider::GetDevices(std::vector<VRDevice*>* devices) { 35 void GvrDeviceProvider::GetDevices(std::vector<VRDevice*>* devices) {
36 Initialize(); 36 Initialize();
37 devices->push_back(vr_device_.get()); 37 if (initialized_)
38 devices->push_back(vr_device_.get());
38 } 39 }
39 40
40 void GvrDeviceProvider::Initialize() { 41 void GvrDeviceProvider::Initialize() {
41 // TODO(mthiesse): Clean up how we connect the GvrDelegateProvider to the 42 // TODO(mthiesse): Clean up how we connect the GvrDelegateProvider to the
42 // GvrDeviceProvider so we don't have to call this function multiple times. 43 // GvrDeviceProvider so we don't have to call this function multiple times.
43 // Ideally the DelegateProvider would always be available, and GetInstance() 44 // Ideally the DelegateProvider would always be available, and GetInstance()
44 // would create it. 45 // would create it.
45 if (initialized_) 46 if (initialized_)
46 return; 47 return;
47 device::GvrDelegateProvider* delegate_provider = 48 device::GvrDelegateProvider* delegate_provider =
(...skipping 29 matching lines...) Expand all
77 Initialize(); 78 Initialize();
78 device::GvrDelegateProvider* delegate_provider = 79 device::GvrDelegateProvider* delegate_provider =
79 device::GvrDelegateProvider::GetInstance(); 80 device::GvrDelegateProvider::GetInstance();
80 if (!delegate_provider) 81 if (!delegate_provider)
81 return; 82 return;
82 83
83 delegate_provider->SetListeningForActivate(listening); 84 delegate_provider->SetListeningForActivate(listening);
84 } 85 }
85 86
86 } // namespace device 87 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698