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

Side by Side Diff: services/ui/input_devices/input_device_server.cc

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Created 3 years, 8 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
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 "services/ui/input_devices/input_device_server.h" 5 #include "services/ui/input_devices/input_device_server.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "services/service_manager/public/cpp/interface_registry.h" 10 #include "services/service_manager/public/cpp/interface_registry.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void InputDeviceServer::OnTouchpadDeviceConfigurationChanged() { 81 void InputDeviceServer::OnTouchpadDeviceConfigurationChanged() {
82 if (!manager_->AreDeviceListsComplete()) 82 if (!manager_->AreDeviceListsComplete())
83 return; 83 return;
84 84
85 auto& devices = manager_->GetTouchpadDevices(); 85 auto& devices = manager_->GetTouchpadDevices();
86 observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) { 86 observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
87 observer->OnTouchpadDeviceConfigurationChanged(devices); 87 observer->OnTouchpadDeviceConfigurationChanged(devices);
88 }); 88 });
89 } 89 }
90 90
91 void InputDeviceServer::OnGamepadDeviceConfigurationChanged() {
92 if (!manager_->AreDeviceListsComplete())
93 return;
94
95 auto& devices = manager_->GetGamepadDevices();
96 observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
97 observer->OnGamepadDeviceConfigurationChanged(devices);
98 });
99 }
100
91 void InputDeviceServer::OnDeviceListsComplete() { 101 void InputDeviceServer::OnDeviceListsComplete() {
92 observers_.ForAllPtrs([this](mojom::InputDeviceObserverMojo* observer) { 102 observers_.ForAllPtrs([this](mojom::InputDeviceObserverMojo* observer) {
93 SendDeviceListsComplete(observer); 103 SendDeviceListsComplete(observer);
94 }); 104 });
95 } 105 }
96 106
97 void InputDeviceServer::OnStylusStateChanged(StylusState state) { 107 void InputDeviceServer::OnStylusStateChanged(StylusState state) {
98 observers_.ForAllPtrs([state](mojom::InputDeviceObserverMojo* observer) { 108 observers_.ForAllPtrs([state](mojom::InputDeviceObserverMojo* observer) {
99 observer->OnStylusStateChanged(state); 109 observer->OnStylusStateChanged(state);
100 }); 110 });
101 } 111 }
102 112
103 void InputDeviceServer::SendDeviceListsComplete( 113 void InputDeviceServer::SendDeviceListsComplete(
104 mojom::InputDeviceObserverMojo* observer) { 114 mojom::InputDeviceObserverMojo* observer) {
105 DCHECK(manager_->AreDeviceListsComplete()); 115 DCHECK(manager_->AreDeviceListsComplete());
106 116
107 observer->OnDeviceListsComplete( 117 observer->OnDeviceListsComplete(
108 manager_->GetKeyboardDevices(), manager_->GetTouchscreenDevices(), 118 manager_->GetKeyboardDevices(), manager_->GetTouchscreenDevices(),
109 manager_->GetMouseDevices(), manager_->GetTouchpadDevices()); 119 manager_->GetMouseDevices(), manager_->GetTouchpadDevices(),
120 manager_->GetGamepadDevices());
110 } 121 }
111 122
112 void InputDeviceServer::Create(const service_manager::Identity& remote_identity, 123 void InputDeviceServer::Create(const service_manager::Identity& remote_identity,
113 mojom::InputDeviceServerRequest request) { 124 mojom::InputDeviceServerRequest request) {
114 bindings_.AddBinding(this, std::move(request)); 125 bindings_.AddBinding(this, std::move(request));
115 } 126 }
116 127
117 } // namespace ui 128 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698