Chromium Code Reviews| Index: chrome/browser/notifications/balloon_collection_impl.h |
| diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h |
| index 887d1f27ddd615d645b2cecad7817039fea837b5..049ea1124ab4e91a79b1f489447fdb9b6a8ee59b 100644 |
| --- a/chrome/browser/notifications/balloon_collection_impl.h |
| +++ b/chrome/browser/notifications/balloon_collection_impl.h |
| @@ -16,6 +16,8 @@ |
| #include "base/message_loop.h" |
| #include "chrome/browser/notifications/balloon_collection.h" |
| #include "chrome/browser/notifications/balloon_collection_base.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| #include "ui/gfx/point.h" |
| #include "ui/gfx/rect.h" |
| @@ -28,11 +30,14 @@ |
| #define USE_OFFSETS 1 |
| #endif |
| +class Browser; |
| + |
| // A balloon collection represents a set of notification balloons being |
| // shown on the screen. It positions new notifications according to |
| // a layout, and monitors for balloons being closed, which it reports |
| // up to its parent, the notification UI manager. |
| -class BalloonCollectionImpl : public BalloonCollection |
| +class BalloonCollectionImpl : public BalloonCollection, |
| + public content::NotificationObserver |
| #if USE_OFFSETS |
| , public MessageLoopForUI::Observer |
| #endif |
| @@ -54,6 +59,11 @@ class BalloonCollectionImpl : public BalloonCollection |
| virtual void OnBalloonClosed(Balloon* source); |
| virtual const Balloons& GetActiveBalloons(); |
| + // content::NotificationObserver interface. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| // MessageLoopForUI::Observer interface. |
| #if defined(OS_WIN) || defined(TOUCH_UI) || defined(USE_AURA) |
| virtual base::EventStatus WillProcessEvent( |
| @@ -127,6 +137,10 @@ class BalloonCollectionImpl : public BalloonCollection |
| // buttons under the cursor during rapid-close interaction. |
| bool RequiresOffsets() const; |
| + // Returns true if there is change to offsets. Passing |closed_browser| |
|
jennb
2011/11/10 19:17:13
s/Passing/Pass in
?
(Irrelevant if you change to
jianli
2011/11/11 00:38:30
Done.
|
| + // if a panel is being closed. |
| + bool ComputeOffsetsToMoveAbovePanels(Browser* closed_browser); |
| + |
| private: |
| // Layout parameters |
| int VerticalEdgeMargin() const; |
| @@ -141,6 +155,13 @@ class BalloonCollectionImpl : public BalloonCollection |
| Placement placement_; |
| gfx::Rect work_area_; |
| + |
| + // The offsets that guarantees that the notificaitons shown in the |
|
jennb
2011/11/10 19:17:13
typo: notifications
jianli
2011/11/11 00:38:30
Done.
|
| + // bottom-right or bottom-left corner of the screen will go above currently |
| + // shown panels and will not be obscured by them. |
| + int bottom_left_offset_to_move_above_panels_; |
| + int bottom_right_offset_to_move_above_panels_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(Layout); |
| }; |
| @@ -171,6 +192,8 @@ class BalloonCollectionImpl : public BalloonCollection |
| // The layout parameters for balloons in this collection. |
| Layout layout_; |
| + content::NotificationRegistrar registrar_; |
| + |
| #if USE_OFFSETS |
| // Start and stop observing all UI events. |
| void AddMessageLoopObserver(); |