| 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_
|
|
|