summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 20:57:34 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 20:57:34 +0000
commit28632b2da6dca24e62a95d934b0ae8d866c7f65c (patch)
tree31d80c463910f7a8d1c77e3be1ac2df75b099df0 /chrome/browser
parent5087511c442b7384de0620344da19608ee491a37 (diff)
downloadchromium_src-28632b2da6dca24e62a95d934b0ae8d866c7f65c.zip
chromium_src-28632b2da6dca24e62a95d934b0ae8d866c7f65c.tar.gz
chromium_src-28632b2da6dca24e62a95d934b0ae8d866c7f65c.tar.bz2
Fix 117074: Panels [WIN]: Crash data shows a stack trace consistently involving PanelManager
The fix is not to involve PanelManager when it is not needed on the balloon notification code. BUG=117074 TEST=Manual test to verify PanelManager is not involved on start. Review URL: http://codereview.chromium.org/9621020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/notifications/balloon_collection_impl.cc9
-rw-r--r--chrome/browser/notifications/balloon_collection_impl.h8
2 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/notifications/balloon_collection_impl.cc b/chrome/browser/notifications/balloon_collection_impl.cc
index ec95f8e..cfeeac6 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_computing_panel_offset();
if (layout_.ComputeOffsetToMoveAbovePanels(bounds))
PositionBalloons(true);
break;
@@ -275,6 +276,7 @@ void BalloonCollectionImpl::HandleMouseMoveEvent() {
BalloonCollectionImpl::Layout::Layout()
: placement_(INVALID),
+ need_to_compute_panel_offset_(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 (!need_to_compute_panel_offset_)
+ return false;
+
const DockedPanelStrip::Panels& panels =
PanelManager::GetInstance()->docked_strip()->panels();
int offset_to_move_above_panels = 0;
diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h
index 749c9e0..f505463 100644
--- a/chrome/browser/notifications/balloon_collection_impl.h
+++ b/chrome/browser/notifications/balloon_collection_impl.h
@@ -143,6 +143,10 @@ class BalloonCollectionImpl : public BalloonCollection,
// to be repositioned.
bool ComputeOffsetToMoveAbovePanels(const gfx::Rect& panel_bounds);
+ void enable_computing_panel_offset() {
+ need_to_compute_panel_offset_ = true;
+ }
+
private:
// Layout parameters
int VerticalEdgeMargin() const;
@@ -161,6 +165,10 @@ class BalloonCollectionImpl : public BalloonCollection,
Placement placement_;
gfx::Rect work_area_;
+ // The flag that indicates that the panel offset computation should be
+ // performed.
+ bool need_to_compute_panel_offset_;
+
// The offset that guarantees that the notificaitions shown in the
// lower-right or lower-left corner of the screen will go above currently
// shown panels and will not be obscured by them.