Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ash / system / tray / system_tray_notifier.cc
blob40e70501df9e1199992ac14135bc6bf0a21152dc
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 FOR_EACH_OBSERVER(AudioObserver, audio_observers_,
206 OnOutputMuteChanged(mute_on));
209 void SystemTrayNotifier::NotifyAudioNodesChanged() {
210 FOR_EACH_OBSERVER(
211 AudioObserver,
212 audio_observers_,
213 OnAudioNodesChanged());
216 void SystemTrayNotifier::NotifyAudioActiveOutputNodeChanged() {
217 FOR_EACH_OBSERVER(
218 AudioObserver,
219 audio_observers_,
220 OnActiveOutputNodeChanged());
223 void SystemTrayNotifier::NotifyAudioActiveInputNodeChanged() {
224 FOR_EACH_OBSERVER(
225 AudioObserver,
226 audio_observers_,
227 OnActiveInputNodeChanged());
230 void SystemTrayNotifier::NotifyTracingModeChanged(bool value) {
231 FOR_EACH_OBSERVER(
232 TracingObserver,
233 tracing_observers_,
234 OnTracingModeChanged(value));
237 void SystemTrayNotifier::NotifyRefreshBluetooth() {
238 FOR_EACH_OBSERVER(BluetoothObserver,
239 bluetooth_observers_,
240 OnBluetoothRefresh());
243 void SystemTrayNotifier::NotifyBluetoothDiscoveringChanged() {
244 FOR_EACH_OBSERVER(BluetoothObserver,
245 bluetooth_observers_,
246 OnBluetoothDiscoveringChanged());
249 void SystemTrayNotifier::NotifyRefreshClock() {
250 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh());
253 void SystemTrayNotifier::NotifyDateFormatChanged() {
254 FOR_EACH_OBSERVER(ClockObserver,
255 clock_observers_,
256 OnDateFormatChanged());
259 void SystemTrayNotifier::NotifySystemClockTimeUpdated() {
260 FOR_EACH_OBSERVER(ClockObserver,
261 clock_observers_,
262 OnSystemClockTimeUpdated());
265 void SystemTrayNotifier::NotifySystemClockCanSetTimeChanged(bool can_set_time) {
266 FOR_EACH_OBSERVER(ClockObserver,
267 clock_observers_,
268 OnSystemClockCanSetTimeChanged(can_set_time));
271 void SystemTrayNotifier::NotifyRefreshIME() {
272 FOR_EACH_OBSERVER(IMEObserver,
273 ime_observers_,
274 OnIMERefresh());
277 void SystemTrayNotifier::NotifyLocaleChanged(
278 LocaleObserver::Delegate* delegate,
279 const std::string& cur_locale,
280 const std::string& from_locale,
281 const std::string& to_locale) {
282 FOR_EACH_OBSERVER(
283 LocaleObserver,
284 locale_observers_,
285 OnLocaleChanged(delegate, cur_locale, from_locale, to_locale));
288 void SystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) {
289 FOR_EACH_OBSERVER(
290 UpdateObserver, update_observers_, OnUpdateRecommended(info));
293 void SystemTrayNotifier::NotifyUserUpdate() {
294 FOR_EACH_OBSERVER(UserObserver,
295 user_observers_,
296 OnUserUpdate());
299 void SystemTrayNotifier::NotifyUserAddedToSession() {
300 FOR_EACH_OBSERVER(UserObserver,
301 user_observers_,
302 OnUserAddedToSession());
305 #if defined(OS_CHROMEOS)
307 void SystemTrayNotifier::NotifyShowLoginButtonChanged(bool show_login_button) {
308 FOR_EACH_OBSERVER(LogoutButtonObserver,
309 logout_button_observers_,
310 OnShowLogoutButtonInTrayChanged(show_login_button));
313 void SystemTrayNotifier::NotifyLogoutDialogDurationChanged(
314 base::TimeDelta duration) {
315 FOR_EACH_OBSERVER(LogoutButtonObserver,
316 logout_button_observers_,
317 OnLogoutDialogDurationChanged(duration));
320 void SystemTrayNotifier::NotifySessionStartTimeChanged() {
321 FOR_EACH_OBSERVER(SessionLengthLimitObserver,
322 session_length_limit_observers_,
323 OnSessionStartTimeChanged());
326 void SystemTrayNotifier::NotifySessionLengthLimitChanged() {
327 FOR_EACH_OBSERVER(SessionLengthLimitObserver,
328 session_length_limit_observers_,
329 OnSessionLengthLimitChanged());
332 void SystemTrayNotifier::NotifyRequestToggleWifi() {
333 FOR_EACH_OBSERVER(NetworkObserver,
334 network_observers_,
335 RequestToggleWifi());
338 void SystemTrayNotifier::NotifyOnCaptivePortalDetected(
339 const std::string& service_path) {
340 FOR_EACH_OBSERVER(NetworkPortalDetectorObserver,
341 network_portal_detector_observers_,
342 OnCaptivePortalDetected(service_path));
345 void SystemTrayNotifier::NotifyEnterpriseDomainChanged() {
346 FOR_EACH_OBSERVER(EnterpriseDomainObserver, enterprise_domain_observers_,
347 OnEnterpriseDomainChanged());
350 void SystemTrayNotifier::NotifyMediaCaptureChanged() {
351 FOR_EACH_OBSERVER(
352 MediaCaptureObserver, media_capture_observers_, OnMediaCaptureChanged());
355 void SystemTrayNotifier::NotifyScreenCaptureStart(
356 const base::Closure& stop_callback,
357 const base::string16& sharing_app_name) {
358 FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
359 OnScreenCaptureStart(stop_callback, sharing_app_name));
362 void SystemTrayNotifier::NotifyScreenCaptureStop() {
363 FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
364 OnScreenCaptureStop());
367 void SystemTrayNotifier::NotifyScreenShareStart(
368 const base::Closure& stop_callback,
369 const base::string16& helper_name) {
370 FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
371 OnScreenShareStart(stop_callback, helper_name));
374 void SystemTrayNotifier::NotifyScreenShareStop() {
375 FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
376 OnScreenShareStop());
379 void SystemTrayNotifier::NotifyLastWindowClosed() {
380 FOR_EACH_OBSERVER(LastWindowClosedObserver,
381 last_window_closed_observers_,
382 OnLastWindowClosed());
385 void SystemTrayNotifier::NotifyVirtualKeyboardSuppressionChanged(
386 bool suppressed) {
387 FOR_EACH_OBSERVER(VirtualKeyboardObserver,
388 virtual_keyboard_observers_,
389 OnKeyboardSuppressionChanged(suppressed));
392 #endif // OS_CHROMEOS
394 } // namespace ash