summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 06:05:36 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 06:05:36 +0000
commitc2e4093ffe2c88f65507bec59064781eeff32ca9 (patch)
tree517becfc781a0e6242810b46743ade9139f1797d
parent6c8beb5f61062a2926301d53f721dd81aa6dfda7 (diff)
downloadchromium_src-c2e4093ffe2c88f65507bec59064781eeff32ca9.zip
chromium_src-c2e4093ffe2c88f65507bec59064781eeff32ca9.tar.gz
chromium_src-c2e4093ffe2c88f65507bec59064781eeff32ca9.tar.bz2
Don't shrink notification.
* There is a known issue where notification gets resized repeatedly. This generates a lot of X/WM events which fills up message loop, and eventually cause freeze. This CL fixes the flickering and freeze caused by above issue. (See chrome/browser/notifications/balloon_collection.cc) The resize issue will be tracked and fixed separately. Correctly shutdown notificatino UI when browser exits. * When restoring session, browser emits BROWSER_CLOSED notification and there is no last active window, and BalloonCollectionImpl was incorrectly shutting down NotificationUI. BUG=chromium-os:3410 TEST=manual: no freeze when calendar notification is shown. Review URL: http://codereview.chromium.org/2307001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48365 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/notifications/balloon_collection_impl.cc13
-rw-r--r--chrome/browser/chromeos/notifications/notification_panel.cc21
2 files changed, 22 insertions, 12 deletions
diff --git a/chrome/browser/chromeos/notifications/balloon_collection_impl.cc b/chrome/browser/chromeos/notifications/balloon_collection_impl.cc
index a0847f8..31a6ef7 100644
--- a/chrome/browser/chromeos/notifications/balloon_collection_impl.cc
+++ b/chrome/browser/chromeos/notifications/balloon_collection_impl.cc
@@ -143,19 +143,20 @@ void BalloonCollectionImpl::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(type == NotificationType::BROWSER_CLOSED);
- if (BrowserList::GetLastActive() == NULL) {
- // When exitting, we need to shutdown all renderers in
- // BalloonViewImpl before IO thread gets deleted in the
- // BrowserProcessImpl's destructor. See http://crbug.com/40810
- // for details.
+ bool app_closing = *Details<bool>(details).ptr();
+ // When exitting, we need to shutdown all renderers in
+ // BalloonViewImpl before IO thread gets deleted in the
+ // BrowserProcessImpl's destructor. See http://crbug.com/40810
+ // for details.
+ if(app_closing)
Shutdown();
- }
}
void BalloonCollectionImpl::Shutdown() {
// We need to remove the panel first because deleting
// views that are not owned by parent will not remove
// themselves from the parent.
+ DLOG(INFO) << "Shutting down notification UI";
notification_ui_.reset();
STLDeleteElements(&balloons_);
}
diff --git a/chrome/browser/chromeos/notifications/notification_panel.cc b/chrome/browser/chromeos/notifications/notification_panel.cc
index 46b44709..5fdba52 100644
--- a/chrome/browser/chromeos/notifications/notification_panel.cc
+++ b/chrome/browser/chromeos/notifications/notification_panel.cc
@@ -550,12 +550,21 @@ void NotificationPanel::ResizeNotification(
std::min(kBalloonMaxWidth, size.width())),
std::max(kBalloonMinHeight,
std::min(kBalloonMaxHeight, size.height())));
- balloon->set_content_size(real_size);
- GetBalloonViewOf(balloon)->Layout();
- UpdatePanel(true);
- if (scroll_to_ == balloon) {
- ScrollBalloonToVisible(scroll_to_);
- scroll_to_ = NULL;
+
+ // Don't allow balloons to shrink. This avoids flickering
+ // which sometimes rapidly reports alternating sizes. Special
+ // case for setting the minimum value.
+ gfx::Size old_size = balloon->content_size();
+ if (real_size.width() > old_size.width() ||
+ real_size.height() > old_size.height() ||
+ real_size == min_bounds_.size()) {
+ balloon->set_content_size(real_size);
+ GetBalloonViewOf(balloon)->Layout();
+ UpdatePanel(true);
+ if (scroll_to_ == balloon) {
+ ScrollBalloonToVisible(scroll_to_);
+ scroll_to_ = NULL;
+ }
}
}