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

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

Issue 2317483002: Add support of vrdisplayconnect and vrdisplaydisconnect event (Closed)
Patch Set: fix missing brace Created 4 years, 3 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 | « device/vr/android/gvr/gvr_device_provider.h ('k') | device/vr/vr_client_dispatcher.h » ('j') | 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 GvrDelegateManager::GetInstance()->RemoveClient(this); 78 GvrDelegateManager::GetInstance()->RemoveClient(this);
79 } 79 }
80 80
81 void GvrDeviceProvider::GetDevices(std::vector<VRDevice*>* devices) { 81 void GvrDeviceProvider::GetDevices(std::vector<VRDevice*>* devices) {
82 Initialize(); 82 Initialize();
83 83
84 if (vr_device_) 84 if (vr_device_)
85 devices->push_back(vr_device_.get()); 85 devices->push_back(vr_device_.get());
86 } 86 }
87 87
88 void GvrDeviceProvider::SetClient(VRClientDispatcher* client) {
89 if (!client_)
90 client_.reset(client);
91 }
92
88 void GvrDeviceProvider::Initialize() { 93 void GvrDeviceProvider::Initialize() {
89 if (!delegate_) { 94 if (!delegate_)
90 delegate_.reset(new GvrDeviceProviderDelegate()); 95 delegate_.reset(new GvrDeviceProviderDelegate());
91 }
92 } 96 }
93 97
94 void GvrDeviceProvider::OnDelegateInitialized(GvrDelegate* delegate) { 98 void GvrDeviceProvider::OnDelegateInitialized(GvrDelegate* delegate) {
95 if (!vr_device_) 99 if (!vr_device_)
96 vr_device_.reset(new GvrDevice(this, delegate)); 100 vr_device_.reset(new GvrDevice(this, delegate));
97 101
98 // Should fire a vrdisplayconnected event here. 102 client_->OnDeviceConnectionStatusChanged(vr_device_.get(), true);
99 } 103 }
100 104
101 void GvrDeviceProvider::OnDelegateShutdown() { 105 void GvrDeviceProvider::OnDelegateShutdown() {
102 // Nothing to do here just yet. Eventually want to shut down the VRDevice and 106 if (client_ && vr_device_)
103 // fire a vrdisplaydisconnected event. 107 client_->OnDeviceConnectionStatusChanged(vr_device_.get(), false);
104 } 108 }
105 109
106 } // namespace device 110 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.h ('k') | device/vr/vr_client_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698