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

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

Issue 2066853002: arc: Show custom notification via notification surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-exo
Patch Set: clean up Created 4 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
(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_COLLECTION_H_
6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_COLLECTION_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/observer_list.h"
13 #include "components/exo/display_observer.h"
14 #include "components/exo/notification_surface.h"
15
16 namespace exo {
17 class NotificationSurface;
18 }
19
20 namespace arc {
21
22 class ArcNotificationManager;
23
24 // Keeps track of NotificationSurface created in exo::Display.
25 class ArcNotificationSurfaceCollection
26 : public exo::DisplayObserver,
27 public exo::NotificationSurface::Observer {
28 public:
29 class Observer {
30 public:
31 // Invoked when a notification surface is added.
32 virtual void OnNotificationSurfaceAdded(
33 exo::NotificationSurface* surface) = 0;
34
35 protected:
36 virtual ~Observer() = default;
37 };
38
39 ArcNotificationSurfaceCollection();
40 ~ArcNotificationSurfaceCollection() override;
41
42 exo::NotificationSurface* GetSurface(
43 const std::string& arc_notification_key) const;
44
45 void AddObserver(Observer* observer);
46 void RemoveObserver(Observer* observer);
47
48 private:
49 void AddSurface(exo::NotificationSurface* surface);
50
51 // exo::DisplayObserver
52 void OnNotificationSurfaceCreated(
53 exo::NotificationSurface* surface) override;
54
55 // exo::NotificationSurface::Observer
56 void OnNotificationSurfaceDestroying(
57 exo::NotificationSurface* surface) override;
58
59 using NotificationSurfaceMap =
60 std::map<std::string, exo::NotificationSurface*>;
61 NotificationSurfaceMap notification_surface_map_;
62
63 base::ObserverList<Observer> observers_;
64
65 DISALLOW_COPY_AND_ASSIGN(ArcNotificationSurfaceCollection);
66 };
67
68 } // namespace arc
69
70 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_COLLECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698