Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: ui/arc/notification/arc_notification_surface_manager.h

Issue 2935893004: Add unittest for ArcNotificationContentView (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_ 5 #ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_H_
6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_ 6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_H_
7 7
8 #include <map>
9 #include <string> 8 #include <string>
10 9
11 #include "base/macros.h" 10 #include "base/macros.h"
12 #include "base/observer_list.h"
13 #include "components/exo/notification_surface_manager.h"
14 11
15 namespace arc { 12 namespace arc {
16 13
14 class ArcNotificationSurface;
15
17 // Keeps track of NotificationSurface. 16 // Keeps track of NotificationSurface.
18 class ArcNotificationSurfaceManager : public exo::NotificationSurfaceManager { 17 class ArcNotificationSurfaceManager {
19 public: 18 public:
20 class Observer { 19 class Observer {
21 public: 20 public:
22 // Invoked when a notification surface is added to the registry. 21 // Invoked when a notification surface is added to the registry.
23 virtual void OnNotificationSurfaceAdded( 22 virtual void OnNotificationSurfaceAdded(
24 exo::NotificationSurface* surface) = 0; 23 ArcNotificationSurface* surface) = 0;
25 24
26 // Invoked when a notification surface is removed from the registry. 25 // Invoked when a notification surface is removed from the registry.
27 virtual void OnNotificationSurfaceRemoved( 26 virtual void OnNotificationSurfaceRemoved(
28 exo::NotificationSurface* surface) = 0; 27 ArcNotificationSurface* surface) = 0;
29 28
30 protected: 29 protected:
31 virtual ~Observer() = default; 30 virtual ~Observer() = default;
32 }; 31 };
33
34 ArcNotificationSurfaceManager();
35 ~ArcNotificationSurfaceManager() override;
36
37 static ArcNotificationSurfaceManager* Get(); 32 static ArcNotificationSurfaceManager* Get();
38 33
39 // exo::NotificationSurfaceManager: 34 virtual ~ArcNotificationSurfaceManager();
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 35
45 void AddObserver(Observer* observer); 36 virtual ArcNotificationSurface* GetArcSurface(
46 void RemoveObserver(Observer* observer); 37 const std::string& notification_id) const = 0;
38 virtual void AddObserver(Observer* observer) = 0;
39 virtual void RemoveObserver(Observer* observer) = 0;
40
41 protected:
42 ArcNotificationSurfaceManager();
47 43
48 private: 44 private:
49 using NotificationSurfaceMap = 45 static ArcNotificationSurfaceManager* instance_;
50 std::map<std::string, exo::NotificationSurface*>;
51 NotificationSurfaceMap notification_surface_map_;
52
53 base::ObserverList<Observer> observers_;
54 46
55 DISALLOW_COPY_AND_ASSIGN(ArcNotificationSurfaceManager); 47 DISALLOW_COPY_AND_ASSIGN(ArcNotificationSurfaceManager);
56 }; 48 };
57 49
58 } // namespace arc 50 } // namespace arc
59 51
60 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_ 52 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_notification_surface_impl.cc ('k') | ui/arc/notification/arc_notification_surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698