Chromium Code Reviews| Index: chrome/browser/notifications/balloon_collection_impl.cc |
| diff --git a/chrome/browser/notifications/balloon_collection_impl.cc b/chrome/browser/notifications/balloon_collection_impl.cc |
| index ec95f8ec42f8584efb9ac77b5e939baebd07e4b0..4b520173eb129abdd3077d414caed2e763aba03c 100644 |
| --- a/chrome/browser/notifications/balloon_collection_impl.cc |
| +++ b/chrome/browser/notifications/balloon_collection_impl.cc |
| @@ -186,6 +186,7 @@ void BalloonCollectionImpl::Observe( |
| // Fall through. |
| case chrome::NOTIFICATION_PANEL_ADDED: |
| case chrome::NOTIFICATION_PANEL_CLOSED: |
| + layout_.enable_panel_offset(); |
| if (layout_.ComputeOffsetToMoveAbovePanels(bounds)) |
| PositionBalloons(true); |
| break; |
| @@ -275,6 +276,7 @@ void BalloonCollectionImpl::HandleMouseMoveEvent() { |
| BalloonCollectionImpl::Layout::Layout() |
| : placement_(INVALID), |
| + panel_offset_enabled_(false), |
| offset_to_move_above_panels_(0) { |
| RefreshSystemMetrics(); |
| } |
| @@ -406,6 +408,13 @@ gfx::Size BalloonCollectionImpl::Layout::ConstrainToSizeLimits( |
| bool BalloonCollectionImpl::Layout::ComputeOffsetToMoveAbovePanels( |
| const gfx::Rect& panel_bounds) { |
| + // If the offset is not enabled due to that we have not received a |
| + // notification about panel, don't proceed because we don't want to call |
| + // PanelManager::GetInstance() to create an instance when panel is not |
| + // present. |
| + if (!panel_offset_enabled_) |
|
jennb
2012/03/08 04:34:18
Does BalloonCollection always exist? No chance of
jianli
2012/03/08 18:26:45
BalloonCollection is created when Chrome is starte
|
| + return false; |
| + |
| const DockedPanelStrip::Panels& panels = |
| PanelManager::GetInstance()->docked_strip()->panels(); |
| int offset_to_move_above_panels = 0; |