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

Side by Side Diff: ash/common/system/tray/system_tray_notifier.cc

Issue 2732813002: chromeos: Move files in //ash/common to //ash, part 1 (Closed)
Patch Set: rebase Created 3 years, 9 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
(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 "ash/common/system/tray/system_tray_notifier.h"
6
7 #include "ash/common/system/accessibility_observer.h"
8 #include "ash/common/system/chromeos/bluetooth/bluetooth_observer.h"
9 #include "ash/common/system/chromeos/enterprise/enterprise_domain_observer.h"
10 #include "ash/common/system/chromeos/network/network_observer.h"
11 #include "ash/common/system/chromeos/network/network_portal_detector_observer.h"
12 #include "ash/common/system/chromeos/screen_security/screen_capture_observer.h"
13 #include "ash/common/system/chromeos/screen_security/screen_share_observer.h"
14 #include "ash/common/system/chromeos/session/last_window_closed_observer.h"
15 #include "ash/common/system/chromeos/session/logout_button_observer.h"
16 #include "ash/common/system/chromeos/session/session_length_limit_observer.h"
17 #include "ash/common/system/chromeos/tray_tracing.h"
18 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_observer. h"
19 #include "ash/common/system/date/clock_observer.h"
20 #include "ash/common/system/ime/ime_observer.h"
21 #include "ash/common/system/user/user_observer.h"
22
23 namespace ash {
24
25 SystemTrayNotifier::SystemTrayNotifier() {}
26
27 SystemTrayNotifier::~SystemTrayNotifier() {}
28
29 void SystemTrayNotifier::AddAccessibilityObserver(
30 AccessibilityObserver* observer) {
31 accessibility_observers_.AddObserver(observer);
32 }
33
34 void SystemTrayNotifier::RemoveAccessibilityObserver(
35 AccessibilityObserver* observer) {
36 accessibility_observers_.RemoveObserver(observer);
37 }
38
39 void SystemTrayNotifier::NotifyAccessibilityModeChanged(
40 AccessibilityNotificationVisibility notify) {
41 for (auto& observer : accessibility_observers_)
42 observer.OnAccessibilityModeChanged(notify);
43 }
44
45 void SystemTrayNotifier::AddBluetoothObserver(BluetoothObserver* observer) {
46 bluetooth_observers_.AddObserver(observer);
47 }
48
49 void SystemTrayNotifier::RemoveBluetoothObserver(BluetoothObserver* observer) {
50 bluetooth_observers_.RemoveObserver(observer);
51 }
52
53 void SystemTrayNotifier::NotifyRefreshBluetooth() {
54 for (auto& observer : bluetooth_observers_)
55 observer.OnBluetoothRefresh();
56 }
57
58 void SystemTrayNotifier::NotifyBluetoothDiscoveringChanged() {
59 for (auto& observer : bluetooth_observers_)
60 observer.OnBluetoothDiscoveringChanged();
61 }
62
63 void SystemTrayNotifier::AddClockObserver(ClockObserver* observer) {
64 clock_observers_.AddObserver(observer);
65 }
66
67 void SystemTrayNotifier::RemoveClockObserver(ClockObserver* observer) {
68 clock_observers_.RemoveObserver(observer);
69 }
70
71 void SystemTrayNotifier::NotifyRefreshClock() {
72 for (auto& observer : clock_observers_)
73 observer.Refresh();
74 }
75
76 void SystemTrayNotifier::NotifyDateFormatChanged() {
77 for (auto& observer : clock_observers_)
78 observer.OnDateFormatChanged();
79 }
80
81 void SystemTrayNotifier::NotifySystemClockTimeUpdated() {
82 for (auto& observer : clock_observers_)
83 observer.OnSystemClockTimeUpdated();
84 }
85
86 void SystemTrayNotifier::NotifySystemClockCanSetTimeChanged(bool can_set_time) {
87 for (auto& observer : clock_observers_)
88 observer.OnSystemClockCanSetTimeChanged(can_set_time);
89 }
90
91 void SystemTrayNotifier::AddEnterpriseDomainObserver(
92 EnterpriseDomainObserver* observer) {
93 enterprise_domain_observers_.AddObserver(observer);
94 }
95
96 void SystemTrayNotifier::RemoveEnterpriseDomainObserver(
97 EnterpriseDomainObserver* observer) {
98 enterprise_domain_observers_.RemoveObserver(observer);
99 }
100
101 void SystemTrayNotifier::NotifyEnterpriseDomainChanged() {
102 for (auto& observer : enterprise_domain_observers_)
103 observer.OnEnterpriseDomainChanged();
104 }
105
106 void SystemTrayNotifier::AddIMEObserver(IMEObserver* observer) {
107 ime_observers_.AddObserver(observer);
108 }
109
110 void SystemTrayNotifier::RemoveIMEObserver(IMEObserver* observer) {
111 ime_observers_.RemoveObserver(observer);
112 }
113
114 void SystemTrayNotifier::NotifyRefreshIME() {
115 for (auto& observer : ime_observers_)
116 observer.OnIMERefresh();
117 }
118
119 void SystemTrayNotifier::NotifyRefreshIMEMenu(bool is_active) {
120 for (auto& observer : ime_observers_)
121 observer.OnIMEMenuActivationChanged(is_active);
122 }
123
124 void SystemTrayNotifier::AddLastWindowClosedObserver(
125 LastWindowClosedObserver* observer) {
126 last_window_closed_observers_.AddObserver(observer);
127 }
128
129 void SystemTrayNotifier::RemoveLastWindowClosedObserver(
130 LastWindowClosedObserver* observer) {
131 last_window_closed_observers_.RemoveObserver(observer);
132 }
133
134 void SystemTrayNotifier::NotifyLastWindowClosed() {
135 for (auto& observer : last_window_closed_observers_)
136 observer.OnLastWindowClosed();
137 }
138
139 void SystemTrayNotifier::AddLogoutButtonObserver(
140 LogoutButtonObserver* observer) {
141 logout_button_observers_.AddObserver(observer);
142 }
143
144 void SystemTrayNotifier::RemoveLogoutButtonObserver(
145 LogoutButtonObserver* observer) {
146 logout_button_observers_.RemoveObserver(observer);
147 }
148
149 void SystemTrayNotifier::NotifyShowLoginButtonChanged(bool show_login_button) {
150 for (auto& observer : logout_button_observers_)
151 observer.OnShowLogoutButtonInTrayChanged(show_login_button);
152 }
153
154 void SystemTrayNotifier::NotifyLogoutDialogDurationChanged(
155 base::TimeDelta duration) {
156 for (auto& observer : logout_button_observers_)
157 observer.OnLogoutDialogDurationChanged(duration);
158 }
159
160 void SystemTrayNotifier::AddNetworkObserver(NetworkObserver* observer) {
161 network_observers_.AddObserver(observer);
162 }
163
164 void SystemTrayNotifier::RemoveNetworkObserver(NetworkObserver* observer) {
165 network_observers_.RemoveObserver(observer);
166 }
167
168 void SystemTrayNotifier::NotifyRequestToggleWifi() {
169 for (auto& observer : network_observers_)
170 observer.RequestToggleWifi();
171 }
172
173 void SystemTrayNotifier::AddNetworkPortalDetectorObserver(
174 NetworkPortalDetectorObserver* observer) {
175 network_portal_detector_observers_.AddObserver(observer);
176 }
177
178 void SystemTrayNotifier::RemoveNetworkPortalDetectorObserver(
179 NetworkPortalDetectorObserver* observer) {
180 network_portal_detector_observers_.RemoveObserver(observer);
181 }
182
183 void SystemTrayNotifier::NotifyOnCaptivePortalDetected(
184 const std::string& guid) {
185 for (auto& observer : network_portal_detector_observers_)
186 observer.OnCaptivePortalDetected(guid);
187 }
188
189 void SystemTrayNotifier::AddScreenCaptureObserver(
190 ScreenCaptureObserver* observer) {
191 screen_capture_observers_.AddObserver(observer);
192 }
193
194 void SystemTrayNotifier::RemoveScreenCaptureObserver(
195 ScreenCaptureObserver* observer) {
196 screen_capture_observers_.RemoveObserver(observer);
197 }
198
199 void SystemTrayNotifier::NotifyScreenCaptureStart(
200 const base::Closure& stop_callback,
201 const base::string16& sharing_app_name) {
202 for (auto& observer : screen_capture_observers_)
203 observer.OnScreenCaptureStart(stop_callback, sharing_app_name);
204 }
205
206 void SystemTrayNotifier::NotifyScreenCaptureStop() {
207 for (auto& observer : screen_capture_observers_)
208 observer.OnScreenCaptureStop();
209 }
210
211 void SystemTrayNotifier::AddScreenShareObserver(ScreenShareObserver* observer) {
212 screen_share_observers_.AddObserver(observer);
213 }
214
215 void SystemTrayNotifier::RemoveScreenShareObserver(
216 ScreenShareObserver* observer) {
217 screen_share_observers_.RemoveObserver(observer);
218 }
219
220 void SystemTrayNotifier::NotifyScreenShareStart(
221 const base::Closure& stop_callback,
222 const base::string16& helper_name) {
223 for (auto& observer : screen_share_observers_)
224 observer.OnScreenShareStart(stop_callback, helper_name);
225 }
226
227 void SystemTrayNotifier::NotifyScreenShareStop() {
228 for (auto& observer : screen_share_observers_)
229 observer.OnScreenShareStop();
230 }
231
232 void SystemTrayNotifier::AddSessionLengthLimitObserver(
233 SessionLengthLimitObserver* observer) {
234 session_length_limit_observers_.AddObserver(observer);
235 }
236
237 void SystemTrayNotifier::RemoveSessionLengthLimitObserver(
238 SessionLengthLimitObserver* observer) {
239 session_length_limit_observers_.RemoveObserver(observer);
240 }
241
242 void SystemTrayNotifier::NotifySessionStartTimeChanged() {
243 for (auto& observer : session_length_limit_observers_)
244 observer.OnSessionStartTimeChanged();
245 }
246
247 void SystemTrayNotifier::NotifySessionLengthLimitChanged() {
248 for (auto& observer : session_length_limit_observers_)
249 observer.OnSessionLengthLimitChanged();
250 }
251
252 void SystemTrayNotifier::AddTracingObserver(TracingObserver* observer) {
253 tracing_observers_.AddObserver(observer);
254 }
255
256 void SystemTrayNotifier::RemoveTracingObserver(TracingObserver* observer) {
257 tracing_observers_.RemoveObserver(observer);
258 }
259
260 void SystemTrayNotifier::NotifyTracingModeChanged(bool value) {
261 for (auto& observer : tracing_observers_)
262 observer.OnTracingModeChanged(value);
263 }
264
265 void SystemTrayNotifier::AddUserObserver(UserObserver* observer) {
266 user_observers_.AddObserver(observer);
267 }
268
269 void SystemTrayNotifier::RemoveUserObserver(UserObserver* observer) {
270 user_observers_.RemoveObserver(observer);
271 }
272
273 void SystemTrayNotifier::NotifyUserUpdate() {
274 for (auto& observer : user_observers_)
275 observer.OnUserUpdate();
276 }
277
278 void SystemTrayNotifier::NotifyUserAddedToSession() {
279 for (auto& observer : user_observers_)
280 observer.OnUserAddedToSession();
281 }
282
283 void SystemTrayNotifier::AddVirtualKeyboardObserver(
284 VirtualKeyboardObserver* observer) {
285 virtual_keyboard_observers_.AddObserver(observer);
286 }
287
288 void SystemTrayNotifier::RemoveVirtualKeyboardObserver(
289 VirtualKeyboardObserver* observer) {
290 virtual_keyboard_observers_.RemoveObserver(observer);
291 }
292
293 void SystemTrayNotifier::NotifyVirtualKeyboardSuppressionChanged(
294 bool suppressed) {
295 for (auto& observer : virtual_keyboard_observers_)
296 observer.OnKeyboardSuppressionChanged(suppressed);
297 }
298
299 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/system_tray_notifier.h ('k') | ash/common/system/tray/system_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698