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

Side by Side Diff: device/gamepad/gamepad_data_fetcher_manager.cc

Issue 2351573002: Added support for GVR controllers (Closed)
Patch Set: Added appropriate Webkit dep to device/vr/BUILD.gn 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 | « no previous file | device/gamepad/gamepad_pad_state_provider.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/gamepad/gamepad_data_fetcher_manager.h" 5 #include "device/gamepad/gamepad_data_fetcher_manager.h"
6 6
7 #include "device/gamepad/gamepad_data_fetcher.h" 7 #include "device/gamepad/gamepad_data_fetcher.h"
8 #include "device/gamepad/gamepad_platform_data_fetcher.h" 8 #include "device/gamepad/gamepad_platform_data_fetcher.h"
9 9
10 namespace device { 10 namespace device {
(...skipping 20 matching lines...) Expand all
31 factories_.push_back(factory); 31 factories_.push_back(factory);
32 if (provider_) { 32 if (provider_) {
33 provider_->AddGamepadDataFetcher(factory->CreateDataFetcher()); 33 provider_->AddGamepadDataFetcher(factory->CreateDataFetcher());
34 } 34 }
35 } 35 }
36 36
37 void GamepadDataFetcherManager::RemoveSourceFactory(GamepadSource source) { 37 void GamepadDataFetcherManager::RemoveSourceFactory(GamepadSource source) {
38 if (provider_) 38 if (provider_)
39 provider_->RemoveSourceGamepadDataFetcher(source); 39 provider_->RemoveSourceGamepadDataFetcher(source);
40 40
41 for (FactoryVector::iterator it = factories_.begin(); it != factories_.end(); 41 for (FactoryVector::iterator it = factories_.begin();
42 ++it) { 42 it != factories_.end();) {
43 if ((*it)->source() == source) { 43 if ((*it)->source() == source) {
44 delete (*it); 44 delete (*it);
45 factories_.erase(it); 45 it = factories_.erase(it);
46 } else {
47 ++it;
46 } 48 }
47 } 49 }
48 } 50 }
49 51
50 void GamepadDataFetcherManager::InitializeProvider(GamepadProvider* provider) { 52 void GamepadDataFetcherManager::InitializeProvider(GamepadProvider* provider) {
51 DCHECK(!provider_); 53 DCHECK(!provider_);
52 54
53 provider_ = provider; 55 provider_ = provider;
54 for (const auto& it : factories_) { 56 for (const auto& it : factories_) {
55 provider_->AddGamepadDataFetcher(it->CreateDataFetcher()); 57 provider_->AddGamepadDataFetcher(it->CreateDataFetcher());
56 } 58 }
57 } 59 }
58 60
59 void GamepadDataFetcherManager::ClearProvider() { 61 void GamepadDataFetcherManager::ClearProvider() {
60 provider_ = nullptr; 62 provider_ = nullptr;
61 } 63 }
62 64
63 } // namespace device 65 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/gamepad/gamepad_pad_state_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698