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

Side by Side Diff: chrome/browser/notifications/notification_ui_manager.h

Issue 4635007: When an extension is uninstalled, close all desktop notifications from that e... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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
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, either currently
47 virtual bool Cancel(const Notification& notification); 48 // displayed or in the queue. Returns true if anything was removed.
49 virtual bool CancelById(const std::string& notification_id);
50
51 // Removes any notifications matching the supplied source origin
52 // (which could be an extension ID), either currently displayed or in the
53 // queue. Returns true if anything was removed.
54 virtual bool CancelAllBySourceOrigin(const GURL& source_origin);
48 55
49 // Returns balloon collection. 56 // Returns balloon collection.
50 BalloonCollection* balloon_collection() { 57 BalloonCollection* balloon_collection() {
51 return balloon_collection_.get(); 58 return balloon_collection_.get();
52 } 59 }
53 60
54 private: 61 private:
55 // Attempts to display notifications from the show_queue if the user 62 // Attempts to display notifications from the show_queue if the user
56 // is active. 63 // is active.
57 void CheckAndShowNotifications(); 64 void CheckAndShowNotifications();
(...skipping 12 matching lines...) Expand all
70 scoped_ptr<BalloonCollection> balloon_collection_; 77 scoped_ptr<BalloonCollection> balloon_collection_;
71 78
72 // A queue of notifications which are waiting to be shown. 79 // A queue of notifications which are waiting to be shown.
73 typedef std::deque<QueuedNotification*> NotificationDeque; 80 typedef std::deque<QueuedNotification*> NotificationDeque;
74 NotificationDeque show_queue_; 81 NotificationDeque show_queue_;
75 82
76 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); 83 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager);
77 }; 84 };
78 85
79 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ 86 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_test_util.h ('k') | chrome/browser/notifications/notification_ui_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698