Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | |
| 10 | 11 |
| 11 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 12 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/notifications/balloon.h" | 14 #include "chrome/browser/notifications/balloon.h" |
| 14 #include "chrome/browser/notifications/balloon_collection.h" | 15 #include "chrome/browser/notifications/balloon_collection.h" |
| 15 | 16 |
| 16 class Notification; | 17 class Notification; |
| 17 class Profile; | 18 class Profile; |
| 18 class QueuedNotification; | 19 class QueuedNotification; |
| 19 class SiteInstance; | 20 class SiteInstance; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 36 void Initialize(BalloonCollection* balloon_collection) { | 37 void Initialize(BalloonCollection* balloon_collection) { |
| 37 DCHECK(!balloon_collection_.get()); | 38 DCHECK(!balloon_collection_.get()); |
| 38 DCHECK(balloon_collection); | 39 DCHECK(balloon_collection); |
| 39 balloon_collection_.reset(balloon_collection); | 40 balloon_collection_.reset(balloon_collection); |
| 40 } | 41 } |
| 41 | 42 |
| 42 // Adds a notification to be displayed. Virtual for unit test override. | 43 // Adds a notification to be displayed. Virtual for unit test override. |
| 43 virtual void Add(const Notification& notification, | 44 virtual void Add(const Notification& notification, |
| 44 Profile* profile); | 45 Profile* profile); |
| 45 | 46 |
| 46 // Removes a notification. | 47 // Removes any notifications matching the supplied ID. |
|
tfarina
2010/11/11 12:56:58
nit: maybe: the given |notification_id|?
John Gregg
2010/11/11 18:13:51
Thanks, but I think it's clear as-is.
| |
| 47 virtual bool Cancel(const Notification& notification); | 48 virtual bool CancelById(const std::string& notification_id); |
| 49 | |
| 50 // Removes any notifications matching the supplied source origin | |
| 51 // (which could be an extension ID). | |
| 52 virtual bool CancelAllBySourceOrigin(const GURL& source_origin); | |
| 48 | 53 |
| 49 // Returns balloon collection. | 54 // Returns balloon collection. |
| 50 BalloonCollection* balloon_collection() { | 55 BalloonCollection* balloon_collection() { |
| 51 return balloon_collection_.get(); | 56 return balloon_collection_.get(); |
| 52 } | 57 } |
| 53 | 58 |
| 54 private: | 59 private: |
| 55 // Attempts to display notifications from the show_queue if the user | 60 // Attempts to display notifications from the show_queue if the user |
| 56 // is active. | 61 // is active. |
| 57 void CheckAndShowNotifications(); | 62 void CheckAndShowNotifications(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 70 scoped_ptr<BalloonCollection> balloon_collection_; | 75 scoped_ptr<BalloonCollection> balloon_collection_; |
| 71 | 76 |
| 72 // A queue of notifications which are waiting to be shown. | 77 // A queue of notifications which are waiting to be shown. |
| 73 typedef std::deque<QueuedNotification*> NotificationDeque; | 78 typedef std::deque<QueuedNotification*> NotificationDeque; |
| 74 NotificationDeque show_queue_; | 79 NotificationDeque show_queue_; |
| 75 | 80 |
| 76 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 81 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
| 77 }; | 82 }; |
| 78 | 83 |
| 79 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 84 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
| OLD | NEW |