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. 4 5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_ 6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "ash/ash_export.h" 12 #include "ash/system/audio/audio_observer.h" 13 #include "ash/system/bluetooth/bluetooth_observer.h" 14 #include "ash/system/chromeos/tray_tracing.h" 15 #include "ash/system/date/clock_observer.h" 16 #include "ash/system/ime/ime_observer.h" 17 #include "ash/system/locale/locale_observer.h" 18 #include "ash/system/tray_accessibility.h" 19 #include "ash/system/user/update_observer.h" 20 #include "ash/system/user/user_observer.h" 21 #include "base/observer_list.h" 22 23 #if defined(OS_CHROMEOS) 24 #include "ash/system/chromeos/enterprise/enterprise_domain_observer.h" 25 #include "ash/system/chromeos/network/network_observer.h" 26 #include "ash/system/chromeos/network/network_portal_detector_observer.h" 27 #include "ash/system/chromeos/screen_security/screen_capture_observer.h" 28 #include "ash/system/chromeos/screen_security/screen_share_observer.h" 29 #include "ash/system/chromeos/session/last_window_closed_observer.h" 30 #include "ash/system/chromeos/session/logout_button_observer.h" 31 #include "ash/system/chromeos/session/session_length_limit_observer.h" 32 #include "ash/system/tray/media_security/media_capture_observer.h" 33 #include "base/time/time.h" 34 #endif 35 36 namespace ash { 37 38 #if defined(OS_CHROMEOS) 39 class NetworkStateNotifier; 40 #endif 41 42 class ASH_EXPORT SystemTrayNotifier { 43 public: 44 SystemTrayNotifier(); 45 ~SystemTrayNotifier(); 46 47 void AddAccessibilityObserver(AccessibilityObserver* observer); 48 void RemoveAccessibilityObserver(AccessibilityObserver* observer); 49 50 void AddAudioObserver(AudioObserver* observer); 51 void RemoveAudioObserver(AudioObserver* observer); 52 53 void AddBluetoothObserver(BluetoothObserver* observer); 54 void RemoveBluetoothObserver(BluetoothObserver* observer); 55 56 void AddClockObserver(ClockObserver* observer); 57 void RemoveClockObserver(ClockObserver* observer); 58 59 void AddIMEObserver(IMEObserver* observer); 60 void RemoveIMEObserver(IMEObserver* observer); 61 62 void AddLocaleObserver(LocaleObserver* observer); 63 void RemoveLocaleObserver(LocaleObserver* observer); 64 65 void AddTracingObserver(TracingObserver* observer); 66 void RemoveTracingObserver(TracingObserver* observer); 67 68 void AddUpdateObserver(UpdateObserver* observer); 69 void RemoveUpdateObserver(UpdateObserver* observer); 70 71 void AddUserObserver(UserObserver* observer); 72 void RemoveUserObserver(UserObserver* observer); 73 74 #if defined(OS_CHROMEOS) 75 void AddLogoutButtonObserver(LogoutButtonObserver* observer); 76 void RemoveLogoutButtonObserver(LogoutButtonObserver* observer); 77 78 void AddSessionLengthLimitObserver(SessionLengthLimitObserver* observer); 79 void RemoveSessionLengthLimitObserver(SessionLengthLimitObserver* observer); 80 81 void AddNetworkObserver(NetworkObserver* observer); 82 void RemoveNetworkObserver(NetworkObserver* observer); 83 84 void AddNetworkPortalDetectorObserver( 85 NetworkPortalDetectorObserver* observer); 86 void RemoveNetworkPortalDetectorObserver( 87 NetworkPortalDetectorObserver* observer); 88 89 void AddEnterpriseDomainObserver(EnterpriseDomainObserver* observer); 90 void RemoveEnterpriseDomainObserver(EnterpriseDomainObserver* observer); 91 92 void AddMediaCaptureObserver(MediaCaptureObserver* observer); 93 void RemoveMediaCaptureObserver(MediaCaptureObserver* observer); 94 95 void AddScreenCaptureObserver(ScreenCaptureObserver* observer); 96 void RemoveScreenCaptureObserver(ScreenCaptureObserver* observer); 97 98 void AddScreenShareObserver(ScreenShareObserver* observer); 99 void RemoveScreenShareObserver(ScreenShareObserver* observer); 100 101 void AddLastWindowClosedObserver(LastWindowClosedObserver* observer); 102 void RemoveLastWindowClosedObserver(LastWindowClosedObserver* observer); 103 #endif 104 105 void NotifyAccessibilityModeChanged( 106 AccessibilityNotificationVisibility notify); 107 void NotifyAudioOutputVolumeChanged(); 108 void NotifyAudioOutputMuteChanged(); 109 void NotifyAudioNodesChanged(); 110 void NotifyAudioActiveOutputNodeChanged(); 111 void NotifyAudioActiveInputNodeChanged(); 112 void NotifyTracingModeChanged(bool value); 113 void NotifyRefreshBluetooth(); 114 void NotifyBluetoothDiscoveringChanged(); 115 void NotifyRefreshClock(); 116 void NotifyDateFormatChanged(); 117 void NotifySystemClockTimeUpdated(); 118 void NotifySystemClockCanSetTimeChanged(bool can_set_time); 119 void NotifyRefreshIME(); 120 void NotifyLocaleChanged(LocaleObserver::Delegate* delegate, 121 const std::string& cur_locale, 122 const std::string& from_locale, 123 const std::string& to_locale); 124 void NotifyUpdateRecommended(UpdateObserver::UpdateSeverity severity); 125 void NotifyUserUpdate(); 126 void NotifyUserAddedToSession(); 127 #if defined(OS_CHROMEOS) 128 void NotifyShowLoginButtonChanged(bool show_login_button); 129 void NotifyLogoutDialogDurationChanged(base::TimeDelta duration); 130 void NotifySessionStartTimeChanged(); 131 void NotifySessionLengthLimitChanged(); 132 void NotifyRequestToggleWifi(); 133 void NotifyOnCaptivePortalDetected(const std::string& service_path); 134 void NotifyEnterpriseDomainChanged(); 135 void NotifyMediaCaptureChanged(); 136 void NotifyScreenCaptureStart(const base::Closure& stop_callback, 137 const base::string16& sharing_app_name); 138 void NotifyScreenCaptureStop(); 139 void NotifyScreenShareStart(const base::Closure& stop_callback, 140 const base::string16& helper_name); 141 void NotifyScreenShareStop(); 142 void NotifyLastWindowClosed(); 143 network_state_notifier()144 NetworkStateNotifier* network_state_notifier() { 145 return network_state_notifier_.get(); 146 } 147 #endif 148 149 private: 150 ObserverList<AccessibilityObserver> accessibility_observers_; 151 ObserverList<AudioObserver> audio_observers_; 152 ObserverList<BluetoothObserver> bluetooth_observers_; 153 ObserverList<ClockObserver> clock_observers_; 154 ObserverList<IMEObserver> ime_observers_; 155 ObserverList<LocaleObserver> locale_observers_; 156 ObserverList<TracingObserver> tracing_observers_; 157 ObserverList<UpdateObserver> update_observers_; 158 ObserverList<UserObserver> user_observers_; 159 #if defined(OS_CHROMEOS) 160 ObserverList<LogoutButtonObserver> logout_button_observers_; 161 ObserverList<SessionLengthLimitObserver> session_length_limit_observers_; 162 ObserverList<NetworkObserver> network_observers_; 163 ObserverList<NetworkPortalDetectorObserver> 164 network_portal_detector_observers_; 165 ObserverList<EnterpriseDomainObserver> enterprise_domain_observers_; 166 ObserverList<MediaCaptureObserver> media_capture_observers_; 167 ObserverList<ScreenCaptureObserver> screen_capture_observers_; 168 ObserverList<ScreenShareObserver> screen_share_observers_; 169 ObserverList<LastWindowClosedObserver> last_window_closed_observers_; 170 scoped_ptr<NetworkStateNotifier> network_state_notifier_; 171 #endif 172 173 DISALLOW_COPY_AND_ASSIGN(SystemTrayNotifier); 174 }; 175 176 } // namespace ash 177 178 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_ 179