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/bluetooth/bluetooth_observer.h" 13 #include "ash/system/brightness/brightness_observer.h" 14 #include "ash/system/chromeos/enterprise/enterprise_domain_observer.h" 15 #include "ash/system/chromeos/network/network_observer.h" 16 #include "ash/system/chromeos/network/sms_observer.h" 17 #include "ash/system/chromeos/tray_tracing.h" 18 #include "ash/system/date/clock_observer.h" 19 #include "ash/system/drive/drive_observer.h" 20 #include "ash/system/ime/ime_observer.h" 21 #include "ash/system/locale/locale_observer.h" 22 #include "ash/system/logout_button/logout_button_observer.h" 23 #include "ash/system/session_length_limit/session_length_limit_observer.h" 24 #include "ash/system/tray_accessibility.h" 25 #include "ash/system/tray_caps_lock.h" 26 #include "ash/system/user/update_observer.h" 27 #include "ash/system/user/user_observer.h" 28 #include "base/observer_list.h" 29 30 #if defined(OS_CHROMEOS) 31 #include "ash/system/chromeos/network/network_observer.h" 32 #include "ash/system/chromeos/network/sms_observer.h" 33 #include "ash/system/chromeos/screen_security/screen_capture_observer.h" 34 #include "ash/system/chromeos/screen_security/screen_share_observer.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 AddBluetoothObserver(BluetoothObserver* observer); 52 void RemoveBluetoothObserver(BluetoothObserver* observer); 53 54 void AddBrightnessObserver(BrightnessObserver* observer); 55 void RemoveBrightnessObserver(BrightnessObserver* observer); 56 57 void AddCapsLockObserver(CapsLockObserver* observer); 58 void RemoveCapsLockObserver(CapsLockObserver* observer); 59 60 void AddClockObserver(ClockObserver* observer); 61 void RemoveClockObserver(ClockObserver* observer); 62 63 void AddDriveObserver(DriveObserver* observer); 64 void RemoveDriveObserver(DriveObserver* observer); 65 66 void AddIMEObserver(IMEObserver* observer); 67 void RemoveIMEObserver(IMEObserver* observer); 68 69 void AddLocaleObserver(LocaleObserver* observer); 70 void RemoveLocaleObserver(LocaleObserver* observer); 71 72 void AddLogoutButtonObserver(LogoutButtonObserver* observer); 73 void RemoveLogoutButtonObserver(LogoutButtonObserver* observer); 74 75 void AddSessionLengthLimitObserver(SessionLengthLimitObserver* observer); 76 void RemoveSessionLengthLimitObserver(SessionLengthLimitObserver* observer); 77 78 void AddTracingObserver(TracingObserver* observer); 79 void RemoveTracingObserver(TracingObserver* observer); 80 81 void AddUpdateObserver(UpdateObserver* observer); 82 void RemoveUpdateObserver(UpdateObserver* observer); 83 84 void AddUserObserver(UserObserver* observer); 85 void RemoveUserObserver(UserObserver* observer); 86 87 #if defined(OS_CHROMEOS) 88 void AddNetworkObserver(NetworkObserver* observer); 89 void RemoveNetworkObserver(NetworkObserver* observer); 90 91 void AddSmsObserver(SmsObserver* observer); 92 void RemoveSmsObserver(SmsObserver* observer); 93 94 void AddEnterpriseDomainObserver(EnterpriseDomainObserver* observer); 95 void RemoveEnterpriseDomainObserver(EnterpriseDomainObserver* observer); 96 97 void AddScreenCaptureObserver(ScreenCaptureObserver* observer); 98 void RemoveScreenCaptureObserver(ScreenCaptureObserver* observer); 99 100 void AddScreenShareObserver(ScreenShareObserver* observer); 101 void RemoveScreenShareObserver(ScreenShareObserver* observer); 102 #endif 103 104 void NotifyAccessibilityModeChanged( 105 AccessibilityNotificationVisibility notify); 106 void NotifyTracingModeChanged(bool value); 107 void NotifyRefreshBluetooth(); 108 void NotifyBluetoothDiscoveringChanged(); 109 void NotifyBrightnessChanged(double level, bool user_initialted); 110 void NotifyCapsLockChanged(bool enabled, bool search_mapped_to_caps_lock); 111 void NotifyRefreshClock(); 112 void NotifyDateFormatChanged(); 113 void NotifySystemClockTimeUpdated(); 114 void NotifyDriveJobUpdated(const DriveOperationStatus& status); 115 void NotifyRefreshIME(bool show_message); 116 void NotifyShowLoginButtonChanged(bool show_login_button); 117 void NotifyLocaleChanged(LocaleObserver::Delegate* delegate, 118 const std::string& cur_locale, 119 const std::string& from_locale, 120 const std::string& to_locale); 121 void NotifySessionStartTimeChanged(); 122 void NotifySessionLengthLimitChanged(); 123 void NotifyUpdateRecommended(UpdateObserver::UpdateSeverity severity); 124 void NotifyUserUpdate(); 125 #if defined(OS_CHROMEOS) 126 void NotifySetNetworkMessage(NetworkTrayDelegate* delegate, 127 NetworkObserver::MessageType message_type, 128 NetworkObserver::NetworkType network_type, 129 const base::string16& title, 130 const base::string16& message, 131 const std::vector<base::string16>& links); 132 void NotifyClearNetworkMessage(NetworkObserver::MessageType message_type); 133 void NotifyRequestToggleWifi(); 134 void NotifyAddSmsMessage(const base::DictionaryValue& message); 135 void NotifyEnterpriseDomainChanged(); 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 143 NetworkStateNotifier* network_state_notifier() { 144 return network_state_notifier_.get(); 145 } 146 #endif 147 148 private: 149 ObserverList<AccessibilityObserver> accessibility_observers_; 150 ObserverList<BluetoothObserver> bluetooth_observers_; 151 ObserverList<BrightnessObserver> brightness_observers_; 152 ObserverList<CapsLockObserver> caps_lock_observers_; 153 ObserverList<ClockObserver> clock_observers_; 154 ObserverList<DriveObserver> drive_observers_; 155 ObserverList<IMEObserver> ime_observers_; 156 ObserverList<LocaleObserver> locale_observers_; 157 ObserverList<LogoutButtonObserver> logout_button_observers_; 158 ObserverList<SessionLengthLimitObserver> session_length_limit_observers_; 159 ObserverList<TracingObserver> tracing_observers_; 160 ObserverList<UpdateObserver> update_observers_; 161 ObserverList<UserObserver> user_observers_; 162 #if defined(OS_CHROMEOS) 163 ObserverList<NetworkObserver> network_observers_; 164 ObserverList<SmsObserver> sms_observers_; 165 ObserverList<EnterpriseDomainObserver> enterprise_domain_observers_; 166 ObserverList<ScreenCaptureObserver> screen_capture_observers_; 167 ObserverList<ScreenShareObserver> screen_share_observers_; 168 scoped_ptr<NetworkStateNotifier> network_state_notifier_; 169 #endif 170 171 DISALLOW_COPY_AND_ASSIGN(SystemTrayNotifier); 172 }; 173 174 } // namespace ash 175 176 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_ 177