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

Side by Side Diff: services/ui/public/cpp/input_devices/input_device_client.cc

Issue 2424613002: Remove usage of FOR_EACH_OBSERVER macro in services/ (Closed)
Patch Set: Created 4 years, 2 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 | « services/navigation/public/cpp/view.cc ('k') | services/ui/public/cpp/window.cc » ('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 "services/ui/public/cpp/input_devices/input_device_client.h" 5 #include "services/ui/public/cpp/input_devices/input_device_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 InputDeviceManager::SetInstance(this); 63 InputDeviceManager::SetInstance(this);
64 } 64 }
65 65
66 mojom::InputDeviceObserverMojoPtr InputDeviceClient::GetIntefacePtr() { 66 mojom::InputDeviceObserverMojoPtr InputDeviceClient::GetIntefacePtr() {
67 return binding_.CreateInterfacePtrAndBind(); 67 return binding_.CreateInterfacePtrAndBind();
68 } 68 }
69 69
70 void InputDeviceClient::OnKeyboardDeviceConfigurationChanged( 70 void InputDeviceClient::OnKeyboardDeviceConfigurationChanged(
71 const std::vector<ui::InputDevice>& devices) { 71 const std::vector<ui::InputDevice>& devices) {
72 keyboard_devices_ = devices; 72 keyboard_devices_ = devices;
73 FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_, 73 for (auto& observer : observers_)
74 OnKeyboardDeviceConfigurationChanged()); 74 observer.OnKeyboardDeviceConfigurationChanged();
75 } 75 }
76 76
77 void InputDeviceClient::OnTouchscreenDeviceConfigurationChanged( 77 void InputDeviceClient::OnTouchscreenDeviceConfigurationChanged(
78 const std::vector<ui::TouchscreenDevice>& devices) { 78 const std::vector<ui::TouchscreenDevice>& devices) {
79 touchscreen_devices_ = devices; 79 touchscreen_devices_ = devices;
80 FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_, 80 for (auto& observer : observers_)
81 OnTouchscreenDeviceConfigurationChanged()); 81 observer.OnTouchscreenDeviceConfigurationChanged();
82 } 82 }
83 83
84 void InputDeviceClient::OnMouseDeviceConfigurationChanged( 84 void InputDeviceClient::OnMouseDeviceConfigurationChanged(
85 const std::vector<ui::InputDevice>& devices) { 85 const std::vector<ui::InputDevice>& devices) {
86 mouse_devices_ = devices; 86 mouse_devices_ = devices;
87 FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_, 87 for (auto& observer : observers_)
88 OnMouseDeviceConfigurationChanged()); 88 observer.OnMouseDeviceConfigurationChanged();
89 } 89 }
90 90
91 void InputDeviceClient::OnTouchpadDeviceConfigurationChanged( 91 void InputDeviceClient::OnTouchpadDeviceConfigurationChanged(
92 const std::vector<ui::InputDevice>& devices) { 92 const std::vector<ui::InputDevice>& devices) {
93 touchpad_devices_ = devices; 93 touchpad_devices_ = devices;
94 FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_, 94 for (auto& observer : observers_)
95 OnTouchpadDeviceConfigurationChanged()); 95 observer.OnTouchpadDeviceConfigurationChanged();
96 } 96 }
97 97
98 void InputDeviceClient::OnDeviceListsComplete( 98 void InputDeviceClient::OnDeviceListsComplete(
99 const std::vector<ui::InputDevice>& keyboard_devices, 99 const std::vector<ui::InputDevice>& keyboard_devices,
100 const std::vector<ui::TouchscreenDevice>& touchscreen_devices, 100 const std::vector<ui::TouchscreenDevice>& touchscreen_devices,
101 const std::vector<ui::InputDevice>& mouse_devices, 101 const std::vector<ui::InputDevice>& mouse_devices,
102 const std::vector<ui::InputDevice>& touchpad_devices) { 102 const std::vector<ui::InputDevice>& touchpad_devices) {
103 // Update the cached device lists if the received list isn't empty. 103 // Update the cached device lists if the received list isn't empty.
104 if (!keyboard_devices.empty()) 104 if (!keyboard_devices.empty())
105 OnKeyboardDeviceConfigurationChanged(keyboard_devices); 105 OnKeyboardDeviceConfigurationChanged(keyboard_devices);
106 if (!touchscreen_devices.empty()) 106 if (!touchscreen_devices.empty())
107 OnTouchscreenDeviceConfigurationChanged(touchscreen_devices); 107 OnTouchscreenDeviceConfigurationChanged(touchscreen_devices);
108 if (!mouse_devices.empty()) 108 if (!mouse_devices.empty())
109 OnMouseDeviceConfigurationChanged(mouse_devices); 109 OnMouseDeviceConfigurationChanged(mouse_devices);
110 if (!touchpad_devices.empty()) 110 if (!touchpad_devices.empty())
111 OnTouchpadDeviceConfigurationChanged(touchpad_devices); 111 OnTouchpadDeviceConfigurationChanged(touchpad_devices);
112 112
113 if (!device_lists_complete_) { 113 if (!device_lists_complete_) {
114 device_lists_complete_ = true; 114 device_lists_complete_ = true;
115 FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_, 115 for (auto& observer : observers_)
116 OnDeviceListsComplete()); 116 observer.OnDeviceListsComplete();
117 } 117 }
118 } 118 }
119 119
120 void InputDeviceClient::OnStylusStateChanged(StylusState state) { 120 void InputDeviceClient::OnStylusStateChanged(StylusState state) {
121 FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_, 121 for (auto& observer : observers_)
122 OnStylusStateChanged(state)); 122 observer.OnStylusStateChanged(state);
123 } 123 }
124 124
125 } // namespace ui 125 } // namespace ui
OLDNEW
« no previous file with comments | « services/navigation/public/cpp/view.cc ('k') | services/ui/public/cpp/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698