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

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

Issue 2066853002: arc: Show custom notification via notification surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-exo
Patch Set: rebase Created 4 years, 5 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_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_
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_notification_manager.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