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

Side by Side Diff: chrome/browser/notifications/balloon_collection_base.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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Handles the visible notification (or balloons).
6
7 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_BASE_H_
8 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_BASE_H_
9 #pragma once
10
11 #include <deque>
12 #include <string>
13
14 #include "base/stl_util-inl.h"
tfarina 2010/11/11 12:56:58 nit: do you need this include here? Can't it be in
John Gregg 2010/11/11 18:13:51 Done.
15 #include "chrome/browser/notifications/balloon.h"
16
17 class GURL;
18
19 // This class implements a basic BalloonCollection with the parts
20 // shared between Chrome UI and ChromeOS UI. Some methods are
21 // still pure virtual which need to be implemented by the particular
tfarina 2010/11/11 12:56:58 That is not true. Pure virtual means "virtual ...
John Gregg 2010/11/11 18:13:51 yep, stale comment all around from when i was inhe
22 // UI implementation.
23 class BalloonCollectionBase {
24 public:
25 BalloonCollectionBase();
26 virtual ~BalloonCollectionBase();
27
28 typedef std::deque<Balloon*> Balloons;
29
30 // Adds a balloon to the collection. Takes ownership of pointer.
31 virtual void Add(Balloon* balloon);
32
33 // Removes a balloon from the collection (if present). Frees
34 // the pointer after removal.
35 virtual void Remove(Balloon* balloon);
36
37 // Finds any balloon matching the given notification id, and
38 // calls CloseByScript on it.
39 virtual bool CloseById(const std::string& id);
40
41 // Removes all balloons matching the given notification source,
42 // and calls CloseByScript on them.
43 virtual bool CloseAllBySourceOrigin(const GURL& source_origin);
44
45 const Balloons& balloons() const { return balloons_; }
46
47 // Returns the balloon matching the given notification.
48 Balloon* FindBalloon(const Notification& notification);
49
50 // The number of balloons being displayed.
51 int count() const { return balloons_.size(); }
tfarina 2010/11/11 12:56:58 nit: static_cast<int>
John Gregg 2010/11/11 18:13:51 Done.
52
53 private:
54 // Queue of active balloons. These pointers are non-owned, and
55 // must be managed by the caller of this class.
56 Balloons balloons_;
57
58 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionBase);
59 };
60
61 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698