| OLD | NEW |
| 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 // Handles the visible notification (or balloons). | 5 // Handles the visible notification (or balloons). |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_H_ | 7 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_H_ |
| 8 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_H_ | 8 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <string> |
| 12 | 13 |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 15 | 16 |
| 16 class Balloon; | 17 class Balloon; |
| 18 class GURL; |
| 17 class Notification; | 19 class Notification; |
| 18 class Profile; | 20 class Profile; |
| 19 | 21 |
| 20 namespace gfx { | 22 namespace gfx { |
| 21 class Size; | 23 class Size; |
| 22 } // namespace gfx | 24 } // namespace gfx |
| 23 | 25 |
| 24 class BalloonCollection { | 26 class BalloonCollection { |
| 25 public: | 27 public: |
| 26 class BalloonSpaceChangeListener { | 28 class BalloonSpaceChangeListener { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 BalloonCollection() | 39 BalloonCollection() |
| 38 : space_change_listener_(NULL) { | 40 : space_change_listener_(NULL) { |
| 39 } | 41 } |
| 40 | 42 |
| 41 virtual ~BalloonCollection() {} | 43 virtual ~BalloonCollection() {} |
| 42 | 44 |
| 43 // Adds a new balloon for the specified notification. | 45 // Adds a new balloon for the specified notification. |
| 44 virtual void Add(const Notification& notification, | 46 virtual void Add(const Notification& notification, |
| 45 Profile* profile) = 0; | 47 Profile* profile) = 0; |
| 46 | 48 |
| 47 // Removes a balloon from the collection if present. Returns | 49 // Removes any balloons that have this notification id. Returns |
| 48 // true if anything was removed. | 50 // true if anything was removed. |
| 49 virtual bool Remove(const Notification& notification) = 0; | 51 virtual bool RemoveById(const std::string& id) = 0; |
| 52 |
| 53 // Removes any balloons that have this source origin. Returns |
| 54 // true if anything was removed. |
| 55 virtual bool RemoveBySourceOrigin(const GURL& source_origin) = 0; |
| 50 | 56 |
| 51 // Is there room to add another notification? | 57 // Is there room to add another notification? |
| 52 virtual bool HasSpace() const = 0; | 58 virtual bool HasSpace() const = 0; |
| 53 | 59 |
| 54 // Request the resizing of a balloon. | 60 // Request the resizing of a balloon. |
| 55 virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size) = 0; | 61 virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size) = 0; |
| 56 | 62 |
| 57 // Update for new screen dimensions. | 63 // Update for new screen dimensions. |
| 58 virtual void DisplayChanged() = 0; | 64 virtual void DisplayChanged() = 0; |
| 59 | 65 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 78 protected: | 84 protected: |
| 79 // Non-owned pointer to an object listening for space changes. | 85 // Non-owned pointer to an object listening for space changes. |
| 80 BalloonSpaceChangeListener* space_change_listener_; | 86 BalloonSpaceChangeListener* space_change_listener_; |
| 81 | 87 |
| 82 // For use only with testing. This callback is invoked when a balloon | 88 // For use only with testing. This callback is invoked when a balloon |
| 83 // is added or removed from the collection. | 89 // is added or removed from the collection. |
| 84 scoped_ptr<Callback0::Type> on_collection_changed_callback_; | 90 scoped_ptr<Callback0::Type> on_collection_changed_callback_; |
| 85 }; | 91 }; |
| 86 | 92 |
| 87 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_H_ | 93 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_H_ |
| OLD | NEW |