summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/balloon_collection_impl.h
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 01:46:07 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 01:46:07 +0000
commit301e5f36c2539ddebd68d98eec9a2c91480d477f (patch)
treee2f00243ab9367d74fad3f3427a726a771f08b26 /chrome/browser/notifications/balloon_collection_impl.h
parentcb0612ea5b10d6003de853d0339869df5adcc985 (diff)
downloadchromium_src-301e5f36c2539ddebd68d98eec9a2c91480d477f.zip
chromium_src-301e5f36c2539ddebd68d98eec9a2c91480d477f.tar.gz
chromium_src-301e5f36c2539ddebd68d98eec9a2c91480d477f.tar.bz2
Revert 66571 - When an extension is uninstalled, close all desktop notifications from that extension.
This change also refactors the balloon collection code to remove duplication between chrome and chromeos. Removes some gross removal code which was using fake notifications just to get the right ID. BUG=58266 TEST=open notifications from extension, uninstall extensions Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=65879 Review URL: http://codereview.chromium.org/4635007 TBR=johnnyg@chromium.org Review URL: http://codereview.chromium.org/5162003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/balloon_collection_impl.h')
-rw-r--r--chrome/browser/notifications/balloon_collection_impl.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h
index 3596a25..a9c7afc 100644
--- a/chrome/browser/notifications/balloon_collection_impl.h
+++ b/chrome/browser/notifications/balloon_collection_impl.h
@@ -13,7 +13,6 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
#include "chrome/browser/notifications/balloon_collection.h"
-#include "chrome/browser/notifications/balloon_collection_base.h"
#include "gfx/point.h"
#include "gfx/rect.h"
@@ -42,13 +41,14 @@ class BalloonCollectionImpl : public BalloonCollection
// BalloonCollection interface.
virtual void Add(const Notification& notification,
Profile* profile);
- virtual bool RemoveById(const std::string& id);
- virtual bool RemoveBySourceOrigin(const GURL& source_origin);
+ virtual bool Remove(const Notification& notification);
virtual bool HasSpace() const;
virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size);
virtual void DisplayChanged();
virtual void OnBalloonClosed(Balloon* source);
- virtual const Balloons& GetActiveBalloons() { return base_.balloons(); }
+ virtual const Balloons& GetActiveBalloons() {
+ return balloons_;
+ }
// MessageLoopForUI::Observer interface.
#if defined(OS_WIN)
@@ -135,6 +135,9 @@ class BalloonCollectionImpl : public BalloonCollection
Profile* profile);
private:
+ // The number of balloons being displayed.
+ int count() const { return balloons_.size(); }
+
// Adjusts the positions of the balloons (e.g., when one is closed).
// Implemented by each platform for specific UI requirements.
void PositionBalloons(bool is_reposition);
@@ -147,12 +150,6 @@ class BalloonCollectionImpl : public BalloonCollection
static gfx::Rect GetMacWorkArea();
#endif
- // Base implementation for the collection of active balloons.
- BalloonCollectionBase base_;
-
- // The layout parameters for balloons in this collection.
- Layout layout_;
-
#if USE_OFFSETS
// Start and stop observing all UI events.
void AddMessageLoopObserver();
@@ -166,7 +163,16 @@ class BalloonCollectionImpl : public BalloonCollection
// Is the current cursor in the balloon area?
bool IsCursorInBalloonCollection() const;
+#endif
+ // Queue of active balloons.
+ typedef std::deque<Balloon*> Balloons;
+ Balloons balloons_;
+
+ // The layout parameters for balloons in this collection.
+ Layout layout_;
+
+#if USE_OFFSETS
// Factory for generating delayed reposition tasks on mouse motion.
ScopedRunnableMethodFactory<BalloonCollectionImpl> reposition_factory_;