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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/arc/notification/arc_notification_surface_collection.h
diff --git a/ui/arc/notification/arc_notification_surface_collection.h b/ui/arc/notification/arc_notification_surface_collection.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5cb3a26ea4cbdeb9ff44e0675ef045f6156a0a4
--- /dev/null
+++ b/ui/arc/notification/arc_notification_surface_collection.h
@@ -0,0 +1,70 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_COLLECTION_H_
+#define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_COLLECTION_H_
+
+#include <map>
+#include <string>
+
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "components/exo/display_observer.h"
+#include "components/exo/notification_surface.h"
+
+namespace exo {
+class NotificationSurface;
+}
+
+namespace arc {
+
+class ArcNotificationManager;
+
+// Keeps track of NotificationSurface created in exo::Display.
+class ArcNotificationSurfaceCollection
+ : public exo::DisplayObserver,
+ public exo::NotificationSurface::Observer {
+ public:
+ class Observer {
+ public:
+ // Invoked when a notification surface is added.
+ virtual void OnNotificationSurfaceAdded(
+ exo::NotificationSurface* surface) = 0;
+
+ protected:
+ virtual ~Observer() = default;
+ };
+
+ ArcNotificationSurfaceCollection();
+ ~ArcNotificationSurfaceCollection() override;
+
+ exo::NotificationSurface* GetSurface(
+ const std::string& arc_notification_key) const;
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ private:
+ void AddSurface(exo::NotificationSurface* surface);
+
+ // exo::DisplayObserver
+ void OnNotificationSurfaceCreated(
+ exo::NotificationSurface* surface) override;
+
+ // exo::NotificationSurface::Observer
+ void OnNotificationSurfaceDestroying(
+ exo::NotificationSurface* surface) override;
+
+ using NotificationSurfaceMap =
+ std::map<std::string, exo::NotificationSurface*>;
+ NotificationSurfaceMap notification_surface_map_;
+
+ base::ObserverList<Observer> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcNotificationSurfaceCollection);
+};
+
+} // namespace arc
+
+#endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_SURFACE_COLLECTION_H_

Powered by Google App Engine
This is Rietveld 408576698