Chromium Code Reviews| 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 COMPONENTS_EXO_NOTIFICATION_SURFACE_REGISTRY_H_ | |
| 6 #define COMPONENTS_EXO_NOTIFICATION_SURFACE_REGISTRY_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/observer_list.h" | |
| 13 | |
| 14 namespace exo { | |
| 15 | |
| 16 class NotificationSurface; | |
| 17 | |
| 18 // Keeps track of NotificationSurface. | |
| 19 class NotificationSurfaceRegistry { | |
|
reveman
2016/06/22 16:44:30
There seems to be multiple levels of indirection h
xiyuan
2016/06/23 14:46:43
Okay. I moved this into ui/arc. However, I did not
| |
| 20 public: | |
| 21 class Observer { | |
| 22 public: | |
| 23 // Invoked when a notification surface is added to the registry. | |
| 24 virtual void OnNotificationSurfaceAdded(NotificationSurface* surface) = 0; | |
| 25 | |
| 26 // Invoked when a notification surface is removed from the registry. | |
| 27 virtual void OnNotificationSurfaceRemoved(NotificationSurface* surface) = 0; | |
| 28 | |
| 29 protected: | |
| 30 virtual ~Observer() = default; | |
| 31 }; | |
| 32 | |
| 33 NotificationSurfaceRegistry(); | |
| 34 ~NotificationSurfaceRegistry(); | |
| 35 | |
| 36 NotificationSurface* GetSurface(const std::string& notification_key) const; | |
| 37 | |
| 38 void AddSurface(NotificationSurface* surface); | |
| 39 void RemoveSurface(NotificationSurface* surface); | |
| 40 | |
| 41 void AddObserver(Observer* observer); | |
| 42 void RemoveObserver(Observer* observer); | |
| 43 | |
| 44 private: | |
| 45 using NotificationSurfaceMap = | |
| 46 std::map<std::string, exo::NotificationSurface*>; | |
| 47 NotificationSurfaceMap notification_surface_map_; | |
| 48 | |
| 49 base::ObserverList<Observer> observers_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(NotificationSurfaceRegistry); | |
| 52 }; | |
| 53 | |
| 54 } // namespace exo | |
| 55 | |
| 56 #endif // COMPONENTS_EXO_NOTIFICATION_SURFACE_REGISTRY_H_ | |
| OLD | NEW |