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