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

Side by Side Diff: chrome/browser/chromeos/notifications/balloon_collection_impl.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: lint fixes 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_CHROMEOS_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 private: 53 private:
54 DISALLOW_COPY_AND_ASSIGN(NotificationUI); 54 DISALLOW_COPY_AND_ASSIGN(NotificationUI);
55 }; 55 };
56 56
57 BalloonCollectionImpl(); 57 BalloonCollectionImpl();
58 virtual ~BalloonCollectionImpl(); 58 virtual ~BalloonCollectionImpl();
59 59
60 // BalloonCollectionInterface overrides 60 // BalloonCollectionInterface overrides
61 virtual void Add(const Notification& notification, 61 virtual void Add(const Notification& notification,
62 Profile* profile); 62 Profile* profile);
63 virtual bool Remove(const Notification& notification); 63 virtual bool RemoveById(const std::string& id);
64 virtual bool RemoveBySourceOrigin(const GURL& origin);
64 virtual bool HasSpace() const; 65 virtual bool HasSpace() const;
65 virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size); 66 virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size);
66 virtual void DisplayChanged() {} 67 virtual void DisplayChanged() {}
67 virtual void OnBalloonClosed(Balloon* source); 68 virtual void OnBalloonClosed(Balloon* source);
68 virtual const Balloons& GetActiveBalloons() { return balloons_; } 69 virtual const Balloons& GetActiveBalloons() { return base_.balloons(); }
69 70
70 // NotificationObserver overrides: 71 // NotificationObserver overrides:
71 virtual void Observe(NotificationType type, 72 virtual void Observe(NotificationType type,
72 const NotificationSource& source, 73 const NotificationSource& source,
73 const NotificationDetails& details); 74 const NotificationDetails& details);
74 75
75 // Adds a callback for DOMUI message. Returns true if the callback 76 // Adds a callback for DOMUI message. Returns true if the callback
76 // is succssfully registered, or false otherwise. It fails to add if 77 // is succssfully registered, or false otherwise. It fails to add if
77 // there is no notification that matches NotificationDelegate::id(), 78 // there is no notification that matches NotificationDelegate::id(),
78 // or a callback for given message already exists. The callback 79 // or a callback for given message already exists. The callback
(...skipping 29 matching lines...) Expand all
108 NotificationUI* notification_ui() { 109 NotificationUI* notification_ui() {
109 return notification_ui_.get(); 110 return notification_ui_.get();
110 } 111 }
111 112
112 protected: 113 protected:
113 // Creates a new balloon. Overridable by unit tests. The caller is 114 // Creates a new balloon. Overridable by unit tests. The caller is
114 // responsible for freeing the pointer returned. 115 // responsible for freeing the pointer returned.
115 virtual Balloon* MakeBalloon(const Notification& notification, 116 virtual Balloon* MakeBalloon(const Notification& notification,
116 Profile* profile); 117 Profile* profile);
117 118
119 // Base implementation for the collection of active balloons.
120 BalloonCollectionBase base_;
121
118 private: 122 private:
119 friend class NotificationPanelTester; 123 friend class NotificationPanelTester;
120 124
121 // Shutdown the notification ui. 125 // Shutdown the notification ui.
122 void Shutdown(); 126 void Shutdown();
123 127
124 // The number of balloons being displayed.
125 int count() const { return balloons_.size(); }
126
127 Balloons::iterator FindBalloon(const Notification& notification);
128
129 // Queue of active balloons.
130 Balloons balloons_;
131
132 scoped_ptr<NotificationUI> notification_ui_; 128 scoped_ptr<NotificationUI> notification_ui_;
133 129
134 NotificationRegistrar registrar_; 130 NotificationRegistrar registrar_;
135 131
136 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImpl); 132 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImpl);
137 }; 133 };
138 134
139 } // namespace chromeos 135 } // namespace chromeos
140 136
141 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ 137 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698