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

Unified Diff: chrome/browser/notifications/notification_ui_manager.h

Issue 194108: adds DesktopNotificationService to Profile (Closed)
Patch Set: more feedback Created 11 years, 2 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: chrome/browser/notifications/notification_ui_manager.h
diff --git a/chrome/browser/notifications/notification_ui_manager.h b/chrome/browser/notifications/notification_ui_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..d30e29c0be7de53075e4378f9e1aa7428febb597
--- /dev/null
+++ b/chrome/browser/notifications/notification_ui_manager.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2009 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 CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
+
+#include <deque>
+
+#include "base/id_map.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/notifications/balloons.h"
+
+class Notification;
+class Profile;
+class QueuedNotification;
+class SiteInstance;
+
+typedef std::deque<QueuedNotification*> NotificationDeque;
+
+// The notification manager manages use of the desktop for notifications.
+// It maintains a queue of pending notifications when space becomes constrained.
+class NotificationUIManager : public BalloonSpaceChangeListener {
+ public:
+ ~NotificationUIManager();
+
+ // Creates a new UI manager without a balloon collection. This
+ // is useful for unit tests.
+ static NotificationUIManager* Create();
+
+ // Initializes the UI manager with a balloon collection; this object
+ // takes ownership of the balloon collection.
+ void Initialize(BalloonCollectionInterface* balloon_collection);
+
+ // Adds a notification to be displayed.
michaeln 2009/10/10 19:10:51 From the callsite, it looks like ownership of site
+ void Add(const Notification& notification,
+ Profile* profile, SiteInstance* site_instance) {
+ // TODO(johnnyg): Implementation of notification UI manager coming soon.
+ }
+
+ private:
+ NotificationUIManager()
+ : balloon_collection_(NULL) {
+ }
+
+ // Attempts to display notifications from the show_queue if the user
+ // is active.
+ void CheckAndShowNotifications();
+
+ // Attempts to display notifications from the show_queue.
+ void ShowNotifications();
+
+ // BalloonCollectionObserver implementation.
+ virtual void OnBalloonSpaceChanged();
+
+ // An owned pointer to the collection of active balloons.
+ scoped_ptr<BalloonCollectionInterface> balloon_collection_;
+
+ // A queue of notifications which are waiting to be shown.
+ NotificationDeque show_queue_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationUIManager);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698