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

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

Issue 2309523003: Plumbing through more WebVR presentation code (Closed)
Patch Set: Addressed Michael's feedack 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_api_manager.h ('k') | device/vr/android/gvr/gvr_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/vr/android/gvr/gvr_api_manager.h"
6
7 namespace device {
8
9 namespace {
10 GvrApiManager* g_gvr_api_manager = nullptr;
11 }
12
13 GvrApiManager* GvrApiManager::GetInstance() {
14 if (!g_gvr_api_manager)
15 g_gvr_api_manager = new GvrApiManager();
16 return g_gvr_api_manager;
17 }
18
19 GvrApiManager::GvrApiManager() {}
20
21 GvrApiManager::~GvrApiManager() {}
22
23 void GvrApiManager::AddClient(GvrApiManagerClient* client) {
24 clients_.push_back(client);
25
26 if (gvr_api_)
27 client->OnGvrApiInitialized(gvr_api_.get());
28 }
29
30 void GvrApiManager::RemoveClient(GvrApiManagerClient* client) {
31 clients_.erase(std::remove(clients_.begin(), clients_.end(), client),
32 clients_.end());
33 }
34
35 void GvrApiManager::Initialize(gvr_context* context) {
36 gvr_api_ = gvr::GvrApi::WrapNonOwned(context);
37
38 for (const auto& client : clients_)
39 client->OnGvrApiInitialized(gvr_api_.get());
40 }
41
42 void GvrApiManager::Shutdown() {
43 if (!gvr_api_)
44 return;
45
46 gvr_api_.reset(nullptr);
47
48 for (const auto& client : clients_)
49 client->OnGvrApiShutdown();
50 }
51
52 gvr::GvrApi* GvrApiManager::gvr_api() {
53 return gvr_api_.get();
54 }
55
56 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/android/gvr/gvr_api_manager.h ('k') | device/vr/android/gvr/gvr_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698