1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89

ash / system / tray / system_tray_notifier.h [blame]

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_
#define ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_

#include <string>

#include "ash/ash_export.h"
#include "base/functional/callback_forward.h"
#include "base/observer_list.h"

namespace ash {

class IMEObserver;
class NetworkObserver;
class ScreenSecurityObserver;
class SystemTrayObserver;
class TrayBubbleView;
class VirtualKeyboardObserver;

namespace mojom {
enum class UpdateSeverity;
}

// Observer and notification manager for the ash system tray.
class ASH_EXPORT SystemTrayNotifier {
 public:
  SystemTrayNotifier();

  SystemTrayNotifier(const SystemTrayNotifier&) = delete;
  SystemTrayNotifier& operator=(const SystemTrayNotifier&) = delete;

  ~SystemTrayNotifier();

  // Input methods.
  void AddIMEObserver(IMEObserver* observer);
  void RemoveIMEObserver(IMEObserver* observer);
  void NotifyRefreshIME();
  void NotifyRefreshIMEMenu(bool is_active);

  // Network.
  void AddNetworkObserver(NetworkObserver* observer);
  void RemoveNetworkObserver(NetworkObserver* observer);
  void NotifyRequestToggleWifi();

  // Screen security.
  void AddScreenSecurityObserver(ScreenSecurityObserver* observer);
  void RemoveScreenSecurityObserver(ScreenSecurityObserver* observer);
  void NotifyScreenAccessStart(base::RepeatingClosure stop_callback,
                               base::RepeatingClosure source_callback,
                               const std::u16string& access_app_name);
  void NotifyScreenAccessStop();
  void NotifyRemotingScreenShareStart(base::RepeatingClosure stop_callback);
  void NotifyRemotingScreenShareStop();

  // System tray focus.
  void AddSystemTrayObserver(SystemTrayObserver* observer);
  void RemoveSystemTrayObserver(SystemTrayObserver* observer);
  void NotifyFocusOut(bool reverse);
  void NotifySystemTrayBubbleShown();
  void NotifyImeMenuTrayBubbleShown();

  // Status area anchored bubble.
  void NotifyStatusAreaAnchoredBubbleVisibilityChanged(
      TrayBubbleView* tray_bubble,
      bool visible);

  void NotifyTrayBubbleBoundsChanged(TrayBubbleView* tray_bubble);

  // Virtual keyboard.
  void AddVirtualKeyboardObserver(VirtualKeyboardObserver* observer);
  void RemoveVirtualKeyboardObserver(VirtualKeyboardObserver* observer);
  void NotifyVirtualKeyboardSuppressionChanged(bool suppressed);

 private:
  base::ObserverList<IMEObserver>::Unchecked ime_observers_;
  base::ObserverList<NetworkObserver>::Unchecked network_observers_;
  base::ObserverList<ScreenSecurityObserver>::Unchecked
      screen_security_observers_;
  base::ObserverList<SystemTrayObserver>::Unchecked system_tray_observers_;
  base::ObserverList<VirtualKeyboardObserver>::Unchecked
      virtual_keyboard_observers_;
};

}  // namespace ash

#endif  // ASH_SYSTEM_TRAY_SYSTEM_TRAY_NOTIFIER_H_