Home | History | Annotate | Download | only in tray
      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/chromeos/tray_tracing.h"
     14 #include "ash/system/date/clock_observer.h"
     15 #include "ash/system/drive/drive_observer.h"
     16 #include "ash/system/ime/ime_observer.h"
     17 #include "ash/system/locale/locale_observer.h"
     18 #include "ash/system/logout_button/logout_button_observer.h"
     19 #include "ash/system/session_length_limit/session_length_limit_observer.h"
     20 #include "ash/system/tray_accessibility.h"
     21 #include "ash/system/tray_caps_lock.h"
     22 #include "ash/system/user/update_observer.h"
     23 #include "ash/system/user/user_observer.h"
     24 #include "base/observer_list.h"
     25 
     26 #if defined(OS_CHROMEOS)
     27 #include "ash/system/chromeos/enterprise/enterprise_domain_observer.h"
     28 #include "ash/system/chromeos/network/network_observer.h"
     29 #include "ash/system/chromeos/screen_security/screen_capture_observer.h"
     30 #include "ash/system/chromeos/screen_security/screen_share_observer.h"
     31 #endif
     32 
     33 namespace ash {
     34 
     35 #if defined(OS_CHROMEOS)
     36 class NetworkStateNotifier;
     37 #endif
     38 
     39 class ASH_EXPORT SystemTrayNotifier {
     40 public:
     41   SystemTrayNotifier();
     42   ~SystemTrayNotifier();
     43 
     44   void AddAccessibilityObserver(AccessibilityObserver* observer);
     45   void RemoveAccessibilityObserver(AccessibilityObserver* observer);
     46 
     47   void AddBluetoothObserver(BluetoothObserver* observer);
     48   void RemoveBluetoothObserver(BluetoothObserver* observer);
     49 
     50   void AddCapsLockObserver(CapsLockObserver* observer);
     51   void RemoveCapsLockObserver(CapsLockObserver* observer);
     52 
     53   void AddClockObserver(ClockObserver* observer);
     54   void RemoveClockObserver(ClockObserver* observer);
     55 
     56   void AddDriveObserver(DriveObserver* observer);
     57   void RemoveDriveObserver(DriveObserver* 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 AddLogoutButtonObserver(LogoutButtonObserver* observer);
     66   void RemoveLogoutButtonObserver(LogoutButtonObserver* observer);
     67 
     68   void AddSessionLengthLimitObserver(SessionLengthLimitObserver* observer);
     69   void RemoveSessionLengthLimitObserver(SessionLengthLimitObserver* observer);
     70 
     71   void AddTracingObserver(TracingObserver* observer);
     72   void RemoveTracingObserver(TracingObserver* observer);
     73 
     74   void AddUpdateObserver(UpdateObserver* observer);
     75   void RemoveUpdateObserver(UpdateObserver* observer);
     76 
     77   void AddUserObserver(UserObserver* observer);
     78   void RemoveUserObserver(UserObserver* observer);
     79 
     80 #if defined(OS_CHROMEOS)
     81   void AddNetworkObserver(NetworkObserver* observer);
     82   void RemoveNetworkObserver(NetworkObserver* observer);
     83 
     84   void AddEnterpriseDomainObserver(EnterpriseDomainObserver* observer);
     85   void RemoveEnterpriseDomainObserver(EnterpriseDomainObserver* observer);
     86 
     87   void AddScreenCaptureObserver(ScreenCaptureObserver* observer);
     88   void RemoveScreenCaptureObserver(ScreenCaptureObserver* observer);
     89 
     90   void AddScreenShareObserver(ScreenShareObserver* observer);
     91   void RemoveScreenShareObserver(ScreenShareObserver* observer);
     92 #endif
     93 
     94   void NotifyAccessibilityModeChanged(
     95       AccessibilityNotificationVisibility notify);
     96   void NotifyTracingModeChanged(bool value);
     97   void NotifyRefreshBluetooth();
     98   void NotifyBluetoothDiscoveringChanged();
     99   void NotifyCapsLockChanged(bool enabled, bool search_mapped_to_caps_lock);
    100   void NotifyRefreshClock();
    101   void NotifyDateFormatChanged();
    102   void NotifySystemClockTimeUpdated();
    103   void NotifyDriveJobUpdated(const DriveOperationStatus& status);
    104   void NotifyRefreshIME(bool show_message);
    105   void NotifyShowLoginButtonChanged(bool show_login_button);
    106   void NotifyLocaleChanged(LocaleObserver::Delegate* delegate,
    107                            const std::string& cur_locale,
    108                            const std::string& from_locale,
    109                            const std::string& to_locale);
    110   void NotifySessionStartTimeChanged();
    111   void NotifySessionLengthLimitChanged();
    112   void NotifyUpdateRecommended(UpdateObserver::UpdateSeverity severity);
    113   void NotifyUserUpdate();
    114   void NotifyUserAddedToSession();
    115 #if defined(OS_CHROMEOS)
    116   void NotifyRequestToggleWifi();
    117   void NotifyEnterpriseDomainChanged();
    118   void NotifyScreenCaptureStart(const base::Closure& stop_callback,
    119                                 const base::string16& sharing_app_name);
    120   void NotifyScreenCaptureStop();
    121   void NotifyScreenShareStart(const base::Closure& stop_callback,
    122                               const base::string16& helper_name);
    123   void NotifyScreenShareStop();
    124 
    125   NetworkStateNotifier* network_state_notifier() {
    126     return network_state_notifier_.get();
    127   }
    128 #endif
    129 
    130  private:
    131   ObserverList<AccessibilityObserver> accessibility_observers_;
    132   ObserverList<BluetoothObserver> bluetooth_observers_;
    133   ObserverList<CapsLockObserver> caps_lock_observers_;
    134   ObserverList<ClockObserver> clock_observers_;
    135   ObserverList<DriveObserver> drive_observers_;
    136   ObserverList<IMEObserver> ime_observers_;
    137   ObserverList<LocaleObserver> locale_observers_;
    138   ObserverList<LogoutButtonObserver> logout_button_observers_;
    139   ObserverList<SessionLengthLimitObserver> session_length_limit_observers_;
    140   ObserverList<TracingObserver> tracing_observers_;
    141   ObserverList<UpdateObserver> update_observers_;
    142   ObserverList<UserObserver> user_observers_;
    143 #if defined(OS_CHROMEOS)
    144   ObserverList<NetworkObserver> network_observers_;
    145   ObserverList<EnterpriseDomainObserver> enterprise_domain_observers_;
    146   ObserverList<ScreenCaptureObserver> screen_capture_observers_;
    147   ObserverList<ScreenShareObserver> screen_share_observers_;
    148   scoped_ptr<NetworkStateNotifier> network_state_notifier_;
    149 #endif
    150 
    151   DISALLOW_COPY_AND_ASSIGN(SystemTrayNotifier);
    152 };
    153 
    154 }  // namespace ash
    155 
    156 #endif  // ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_
    157