Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / ash / system / tray / system_tray_notifier.cc
blobec5bd8d122a6ba7086bae809a0fb31f6d95b3fcc
1 // Copyright (c) 2012 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.
5 #include "ash/system/tray/system_tray_notifier.h"
7 namespace ash {
9 SystemTrayNotifier::SystemTrayNotifier() {
12 SystemTrayNotifier::~SystemTrayNotifier() {
15 void SystemTrayNotifier::AddAccessibilityObserver(
16 AccessibilityObserver* observer) {
17 accessibility_observers_.AddObserver(observer);
20 void SystemTrayNotifier::RemoveAccessibilityObserver(
21 AccessibilityObserver* observer) {
22 accessibility_observers_.RemoveObserver(observer);
25 void SystemTrayNotifier::AddAudioObserver(AudioObserver* observer) {
26 audio_observers_.AddObserver(observer);
29 void SystemTrayNotifier::RemoveAudioObserver(AudioObserver* observer) {
30 audio_observers_.RemoveObserver(observer);
33 void SystemTrayNotifier::AddBluetoothObserver(BluetoothObserver* observer) {
34 bluetooth_observers_.AddObserver(observer);
37 void SystemTrayNotifier::RemoveBluetoothObserver(BluetoothObserver* observer) {
38 bluetooth_observers_.RemoveObserver(observer);
41 void SystemTrayNotifier::AddClockObserver(ClockObserver* observer) {
42 clock_observers_.AddObserver(observer);
45 void SystemTrayNotifier::RemoveClockObserver(ClockObserver* observer) {
46 clock_observers_.RemoveObserver(observer);
49 void SystemTrayNotifier::AddIMEObserver(IMEObserver* observer) {
50 ime_observers_.AddObserver(observer);
53 void SystemTrayNotifier::RemoveIMEObserver(IMEObserver* observer) {
54 ime_observers_.RemoveObserver(observer);
57 void SystemTrayNotifier::AddLocaleObserver(LocaleObserver* observer) {
58 locale_observers_.AddObserver(observer);
61 void SystemTrayNotifier::RemoveLocaleObserver(LocaleObserver* observer) {
62 locale_observers_.RemoveObserver(observer);
65 void SystemTrayNotifier::AddTracingObserver(TracingObserver* observer) {
66 tracing_observers_.AddObserver(observer);
69 void SystemTrayNotifier::RemoveTracingObserver(TracingObserver* observer) {
70 tracing_observers_.RemoveObserver(observer);
73 void SystemTrayNotifier::AddUpdateObserver(UpdateObserver* observer) {
74 update_observers_.AddObserver(observer);
77 void SystemTrayNotifier::RemoveUpdateObserver(UpdateObserver* observer) {
78 update_observers_.RemoveObserver(observer);
81 void SystemTrayNotifier::AddUserObserver(UserObserver* observer) {
82 user_observers_.AddObserver(observer);
85 void SystemTrayNotifier::RemoveUserObserver(UserObserver* observer) {
86 user_observers_.RemoveObserver(observer);
89 #if defined(OS_CHROMEOS)
91 void SystemTrayNotifier::AddLogoutButtonObserver(
92 LogoutButtonObserver* observer) {
93 logout_button_observers_.AddObserver(observer);
96 void SystemTrayNotifier::RemoveLogoutButtonObserver(
97 LogoutButtonObserver* observer) {
98 logout_button_observers_.RemoveObserver(observer);
101 void SystemTrayNotifier::AddSessionLengthLimitObserver(
102 SessionLengthLimitObserver* observer) {
103 session_length_limit_observers_.AddObserver(observer);
106 void SystemTrayNotifier::RemoveSessionLengthLimitObserver(
107 SessionLengthLimitObserver* observer) {
108 session_length_limit_observers_.RemoveObserver(observer);
111 void SystemTrayNotifier::AddNetworkObserver(NetworkObserver* observer) {
112 network_observers_.AddObserver(observer);
115 void SystemTrayNotifier::RemoveNetworkObserver(NetworkObserver* observer) {
116 network_observers_.RemoveObserver(observer);
119 void SystemTrayNotifier::AddNetworkPortalDetectorObserver(
120 NetworkPortalDetectorObserver* observer) {
121 network_portal_detector_observers_.AddObserver(observer);
124 void SystemTrayNotifier::RemoveNetworkPortalDetectorObserver(
125 NetworkPortalDetectorObserver* observer) {
126 network_portal_detector_observers_.RemoveObserver(observer);
129 void SystemTrayNotifier::AddEnterpriseDomainObserver(
130 EnterpriseDomainObserver* observer) {
131 enterprise_domain_observers_.AddObserver(observer);
134 void SystemTrayNotifier::RemoveEnterpriseDomainObserver(
135 EnterpriseDomainObserver* observer) {
136 enterprise_domain_observers_.RemoveObserver(observer);
139 void SystemTrayNotifier::AddMediaCaptureObserver(
140 MediaCaptureObserver* observer) {
141 media_capture_observers_.AddObserver(observer);
144 void SystemTrayNotifier::RemoveMediaCaptureObserver(
145 MediaCaptureObserver* observer) {
146 media_capture_observers_.RemoveObserver(observer);
149 void SystemTrayNotifier::AddScreenCaptureObserver(
150 ScreenCaptureObserver* observer) {
151 screen_capture_observers_.AddObserver(observer);
154 void SystemTrayNotifier::RemoveScreenCaptureObserver(
155 ScreenCaptureObserver* observer) {
156 screen_capture_observers_.RemoveObserver(observer);
159 void SystemTrayNotifier::AddScreenShareObserver(
160 ScreenShareObserver* observer) {
161 screen_share_observers_.AddObserver(observer);
164 void SystemTrayNotifier::RemoveScreenShareObserver(
165 ScreenShareObserver* observer) {
166 screen_share_observers_.RemoveObserver(observer);
169 void SystemTrayNotifier::AddLastWindowClosedObserver(
170 LastWindowClosedObserver* observer) {
171 last_window_closed_observers_.AddObserver(observer);
174 void SystemTrayNotifier::RemoveLastWindowClosedObserver(
175 LastWindowClosedObserver* observer) {
176 last_window_closed_observers_.RemoveObserver(observer);
179 void SystemTrayNotifier::AddVirtualKeyboardObserver(
180 VirtualKeyboardObserver* observer) {
181 virtual_keyboard_observers_.AddObserver(observer);
184 void SystemTrayNotifier::RemoveVirtualKeyboardObserver(
185 VirtualKeyboardObserver* observer) {
186 virtual_keyboard_observers_.RemoveObserver(observer);
188 #endif
190 void SystemTrayNotifier::NotifyAccessibilityModeChanged(
191 ui::AccessibilityNotificationVisibility notify) {
192 FOR_EACH_OBSERVER(
193 AccessibilityObserver,
194 accessibility_observers_,
195 OnAccessibilityModeChanged(notify));
198 void SystemTrayNotifier::NotifyAudioOutputVolumeChanged(uint64_t node_id,
199 double volume) {
200 FOR_EACH_OBSERVER(AudioObserver, audio_observers_,
201 OnOutputNodeVolumeChanged(node_id, volume));
204 void SystemTrayNotifier::NotifyAudioOutputMuteChanged(bool mute_on,
205 bool system_adjust) {
206 FOR_EACH_OBSERVER(AudioObserver, audio_observers_,
207 OnOutputMuteChanged(mute_on, system_adjust));
210 void SystemTrayNotifier::NotifyAudioNodesChanged() {
211 FOR_EACH_OBSERVER(
212 AudioObserver,
213 audio_observers_,
214 OnAudioNodesChanged());
217 void SystemTrayNotifier::NotifyAudioActiveOutputNodeChanged() {
218 FOR_EACH_OBSERVER(
219 AudioObserver,
220 audio_observers_,
221 OnActiveOutputNodeChanged());
224 void SystemTrayNotifier::NotifyAudioActiveInputNodeChanged() {
225 FOR_EACH_OBSERVER(
226 AudioObserver,
227 audio_observers_,
228 OnActiveInputNodeChanged());
231 void SystemTrayNotifier::NotifyTracingModeChanged(bool value) {
232 FOR_EACH_OBSERVER(
233 TracingObserver,
234 tracing_observers_,
235 OnTracingModeChanged(value));
238 void SystemTrayNotifier::NotifyRefreshBluetooth() {
239 FOR_EACH_OBSERVER(BluetoothObserver,
240 bluetooth_observers_,
241 OnBluetoothRefresh());
244 void SystemTrayNotifier::NotifyBluetoothDiscoveringChanged() {
245 FOR_EACH_OBSERVER(BluetoothObserver,
246 bluetooth_observers_,
247 OnBluetoothDiscoveringChanged());
250 void SystemTrayNotifier::NotifyRefreshClock() {
251 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh());
254 void SystemTrayNotifier::NotifyDateFormatChanged() {
255 FOR_EACH_OBSERVER(ClockObserver,
256 clock_observers_,
257 OnDateFormatChanged());
260 void SystemTrayNotifier::NotifySystemClockTimeUpdated() {
261 FOR_EACH_OBSERVER(ClockObserver,
262 clock_observers_,
263 OnSystemClockTimeUpdated());
266 void SystemTrayNotifier::NotifySystemClockCanSetTimeChanged(bool can_set_time) {
267 FOR_EACH_OBSERVER(ClockObserver,
268 clock_observers_,
269 OnSystemClockCanSetTimeChanged(can_set_time));
272 void SystemTrayNotifier::NotifyRefreshIME() {
273 FOR_EACH_OBSERVER(IMEObserver,
274 ime_observers_,
275 OnIMERefresh());
278 void SystemTrayNotifier::NotifyLocaleChanged(
279 LocaleObserver::Delegate* delegate,
280 const std::string& cur_locale,
281 const std::string& from_locale,
282 const std::string& to_locale) {
283 FOR_EACH_OBSERVER(
284 LocaleObserver,
285 locale_observers_,
286 OnLocaleChanged(delegate, cur_locale, from_locale, to_locale));
289 void SystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) {
290 FOR_EACH_OBSERVER(
291 UpdateObserver, update_observers_, OnUpdateRecommended(info));
294 void SystemTrayNotifier::NotifyUserUpdate() {
295 FOR_EACH_OBSERVER(UserObserver,
296 user_observers_,
297 OnUserUpdate());
300 void SystemTrayNotifier::NotifyUserAddedToSession() {
301 FOR_EACH_OBSERVER(UserObserver,
302 user_observers_,
303 OnUserAddedToSession());
306 #if defined(OS_CHROMEOS)
308 void SystemTrayNotifier::NotifyShowLoginButtonChanged(bool show_login_button) {
309 FOR_EACH_OBSERVER(LogoutButtonObserver,
310 logout_button_observers_,
311 OnShowLogoutButtonInTrayChanged(show_login_button));
314 void SystemTrayNotifier::NotifyLogoutDialogDurationChanged(
315 base::TimeDelta duration) {
316 FOR_EACH_OBSERVER(LogoutButtonObserver,
317 logout_button_observers_,
318 OnLogoutDialogDurationChanged(duration));
321 void SystemTrayNotifier::NotifySessionStartTimeChanged() {
322 FOR_EACH_OBSERVER(SessionLengthLimitObserver,
323 session_length_limit_observers_,
324 OnSessionStartTimeChanged());
327 void SystemTrayNotifier::NotifySessionLengthLimitChanged() {
328 FOR_EACH_OBSERVER(SessionLengthLimitObserver,
329 session_length_limit_observers_,
330 OnSessionLengthLimitChanged());
333 void SystemTrayNotifier::NotifyRequestToggleWifi() {
334 FOR_EACH_OBSERVER(NetworkObserver,
335 network_observers_,
336 RequestToggleWifi());
339 void SystemTrayNotifier::NotifyOnCaptivePortalDetected(
340 const std::string& service_path) {
341 FOR_EACH_OBSERVER(NetworkPortalDetectorObserver,
342 network_portal_detector_observers_,
343 OnCaptivePortalDetected(service_path));
346 void SystemTrayNotifier::NotifyEnterpriseDomainChanged() {
347 FOR_EACH_OBSERVER(EnterpriseDomainObserver, enterprise_domain_observers_,
348 OnEnterpriseDomainChanged());
351 void SystemTrayNotifier::NotifyMediaCaptureChanged() {
352 FOR_EACH_OBSERVER(
353 MediaCaptureObserver, media_capture_observers_, OnMediaCaptureChanged());
356 void SystemTrayNotifier::NotifyScreenCaptureStart(
357 const base::Closure& stop_callback,
358 const base::string16& sharing_app_name) {
359 FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
360 OnScreenCaptureStart(stop_callback, sharing_app_name));
363 void SystemTrayNotifier::NotifyScreenCaptureStop() {
364 FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
365 OnScreenCaptureStop());
368 void SystemTrayNotifier::NotifyScreenShareStart(
369 const base::Closure& stop_callback,
370 const base::string16& helper_name) {
371 FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
372 OnScreenShareStart(stop_callback, helper_name));
375 void SystemTrayNotifier::NotifyScreenShareStop() {
376 FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
377 OnScreenShareStop());
380 void SystemTrayNotifier::NotifyLastWindowClosed() {
381 FOR_EACH_OBSERVER(LastWindowClosedObserver,
382 last_window_closed_observers_,
383 OnLastWindowClosed());
386 void SystemTrayNotifier::NotifyVirtualKeyboardSuppressionChanged(
387 bool suppressed) {
388 FOR_EACH_OBSERVER(VirtualKeyboardObserver,
389 virtual_keyboard_observers_,
390 OnKeyboardSuppressionChanged(suppressed));
393 #endif // OS_CHROMEOS
395 } // namespace ash