ProfilePolicyConnectorFactory: Refactoring from Profile to BrowserContext.
[chromium-blink-merge.git] / ash / system / tray / system_tray_notifier.cc
blob81ed05f53b38a34ad8706ef3040f2fb23825c57a
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() {
199 FOR_EACH_OBSERVER(
200 AudioObserver,
201 audio_observers_,
202 OnOutputVolumeChanged());
205 void SystemTrayNotifier::NotifyAudioOutputMuteChanged() {
206 FOR_EACH_OBSERVER(
207 AudioObserver,
208 audio_observers_,
209 OnOutputMuteChanged());
212 void SystemTrayNotifier::NotifyAudioNodesChanged() {
213 FOR_EACH_OBSERVER(
214 AudioObserver,
215 audio_observers_,
216 OnAudioNodesChanged());
219 void SystemTrayNotifier::NotifyAudioActiveOutputNodeChanged() {
220 FOR_EACH_OBSERVER(
221 AudioObserver,
222 audio_observers_,
223 OnActiveOutputNodeChanged());
226 void SystemTrayNotifier::NotifyAudioActiveInputNodeChanged() {
227 FOR_EACH_OBSERVER(
228 AudioObserver,
229 audio_observers_,
230 OnActiveInputNodeChanged());
233 void SystemTrayNotifier::NotifyTracingModeChanged(bool value) {
234 FOR_EACH_OBSERVER(
235 TracingObserver,
236 tracing_observers_,
237 OnTracingModeChanged(value));
240 void SystemTrayNotifier::NotifyRefreshBluetooth() {
241 FOR_EACH_OBSERVER(BluetoothObserver,
242 bluetooth_observers_,
243 OnBluetoothRefresh());
246 void SystemTrayNotifier::NotifyBluetoothDiscoveringChanged() {
247 FOR_EACH_OBSERVER(BluetoothObserver,
248 bluetooth_observers_,
249 OnBluetoothDiscoveringChanged());
252 void SystemTrayNotifier::NotifyRefreshClock() {
253 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh());
256 void SystemTrayNotifier::NotifyDateFormatChanged() {
257 FOR_EACH_OBSERVER(ClockObserver,
258 clock_observers_,
259 OnDateFormatChanged());
262 void SystemTrayNotifier::NotifySystemClockTimeUpdated() {
263 FOR_EACH_OBSERVER(ClockObserver,
264 clock_observers_,
265 OnSystemClockTimeUpdated());
268 void SystemTrayNotifier::NotifySystemClockCanSetTimeChanged(bool can_set_time) {
269 FOR_EACH_OBSERVER(ClockObserver,
270 clock_observers_,
271 OnSystemClockCanSetTimeChanged(can_set_time));
274 void SystemTrayNotifier::NotifyRefreshIME() {
275 FOR_EACH_OBSERVER(IMEObserver,
276 ime_observers_,
277 OnIMERefresh());
280 void SystemTrayNotifier::NotifyLocaleChanged(
281 LocaleObserver::Delegate* delegate,
282 const std::string& cur_locale,
283 const std::string& from_locale,
284 const std::string& to_locale) {
285 FOR_EACH_OBSERVER(
286 LocaleObserver,
287 locale_observers_,
288 OnLocaleChanged(delegate, cur_locale, from_locale, to_locale));
291 void SystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) {
292 FOR_EACH_OBSERVER(
293 UpdateObserver, update_observers_, OnUpdateRecommended(info));
296 void SystemTrayNotifier::NotifyUserUpdate() {
297 FOR_EACH_OBSERVER(UserObserver,
298 user_observers_,
299 OnUserUpdate());
302 void SystemTrayNotifier::NotifyUserAddedToSession() {
303 FOR_EACH_OBSERVER(UserObserver,
304 user_observers_,
305 OnUserAddedToSession());
308 #if defined(OS_CHROMEOS)
310 void SystemTrayNotifier::NotifyShowLoginButtonChanged(bool show_login_button) {
311 FOR_EACH_OBSERVER(LogoutButtonObserver,
312 logout_button_observers_,
313 OnShowLogoutButtonInTrayChanged(show_login_button));
316 void SystemTrayNotifier::NotifyLogoutDialogDurationChanged(
317 base::TimeDelta duration) {
318 FOR_EACH_OBSERVER(LogoutButtonObserver,
319 logout_button_observers_,
320 OnLogoutDialogDurationChanged(duration));
323 void SystemTrayNotifier::NotifySessionStartTimeChanged() {
324 FOR_EACH_OBSERVER(SessionLengthLimitObserver,
325 session_length_limit_observers_,
326 OnSessionStartTimeChanged());
329 void SystemTrayNotifier::NotifySessionLengthLimitChanged() {
330 FOR_EACH_OBSERVER(SessionLengthLimitObserver,
331 session_length_limit_observers_,
332 OnSessionLengthLimitChanged());
335 void SystemTrayNotifier::NotifyRequestToggleWifi() {
336 FOR_EACH_OBSERVER(NetworkObserver,
337 network_observers_,
338 RequestToggleWifi());
341 void SystemTrayNotifier::NotifyOnCaptivePortalDetected(
342 const std::string& service_path) {
343 FOR_EACH_OBSERVER(NetworkPortalDetectorObserver,
344 network_portal_detector_observers_,
345 OnCaptivePortalDetected(service_path));
348 void SystemTrayNotifier::NotifyEnterpriseDomainChanged() {
349 FOR_EACH_OBSERVER(EnterpriseDomainObserver, enterprise_domain_observers_,
350 OnEnterpriseDomainChanged());
353 void SystemTrayNotifier::NotifyMediaCaptureChanged() {
354 FOR_EACH_OBSERVER(
355 MediaCaptureObserver, media_capture_observers_, OnMediaCaptureChanged());
358 void SystemTrayNotifier::NotifyScreenCaptureStart(
359 const base::Closure& stop_callback,
360 const base::string16& sharing_app_name) {
361 FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
362 OnScreenCaptureStart(stop_callback, sharing_app_name));
365 void SystemTrayNotifier::NotifyScreenCaptureStop() {
366 FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
367 OnScreenCaptureStop());
370 void SystemTrayNotifier::NotifyScreenShareStart(
371 const base::Closure& stop_callback,
372 const base::string16& helper_name) {
373 FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
374 OnScreenShareStart(stop_callback, helper_name));
377 void SystemTrayNotifier::NotifyScreenShareStop() {
378 FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
379 OnScreenShareStop());
382 void SystemTrayNotifier::NotifyLastWindowClosed() {
383 FOR_EACH_OBSERVER(LastWindowClosedObserver,
384 last_window_closed_observers_,
385 OnLastWindowClosed());
388 void SystemTrayNotifier::NotifyVirtualKeyboardSuppressionChanged(
389 bool suppressed) {
390 FOR_EACH_OBSERVER(VirtualKeyboardObserver,
391 virtual_keyboard_observers_,
392 OnKeyboardSuppressionChanged(suppressed));
395 #endif // OS_CHROMEOS
397 } // namespace ash