OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_ |
| 6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/observer_list.h" |
| 13 #include "components/exo/notification_surface_manager.h" |
| 14 |
| 15 namespace arc { |
| 16 |
| 17 // Keeps track of NotificationSurface. |
| 18 class ArcNotificationSurfaceManager : public exo::NotificationSurfaceManager { |
| 19 public: |
| 20 class Observer { |
| 21 public: |
| 22 // Invoked when a notification surface is added to the registry. |
| 23 virtual void OnNotificationSurfaceAdded( |
| 24 exo::NotificationSurface* surface) = 0; |
| 25 |
| 26 // Invoked when a notification surface is removed from the registry. |
| 27 virtual void OnNotificationSurfaceRemoved( |
| 28 exo::NotificationSurface* surface) = 0; |
| 29 |
| 30 protected: |
| 31 virtual ~Observer() = default; |
| 32 }; |
| 33 |
| 34 ArcNotificationSurfaceManager(); |
| 35 ~ArcNotificationSurfaceManager() override; |
| 36 |
| 37 static ArcNotificationSurfaceManager* Get(); |
| 38 |
| 39 // exo::NotificationSurfaceManager: |
| 40 exo::NotificationSurface* GetSurface( |
| 41 const std::string& notification_id) const override; |
| 42 void AddSurface(exo::NotificationSurface* surface) override; |
| 43 void RemoveSurface(exo::NotificationSurface* surface) override; |
| 44 |
| 45 void AddObserver(Observer* observer); |
| 46 void RemoveObserver(Observer* observer); |
| 47 |
| 48 private: |
| 49 using NotificationSurfaceMap = |
| 50 std::map<std::string, exo::NotificationSurface*>; |
| 51 NotificationSurfaceMap notification_surface_map_; |
| 52 |
| 53 base::ObserverList<Observer> observers_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ArcNotificationSurfaceManager); |
| 56 }; |
| 57 |
| 58 } // namespace arc |
| 59 |
| 60 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_ |
OLD | NEW |