Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Unified Diff: chrome/browser/ui/views/notifications/balloon_view_views.cc

Issue 11143031: Attempt at fixing crash in balloon code. The current code does a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/notifications/balloon_view_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/notifications/balloon_view_views.cc
diff --git a/chrome/browser/ui/views/notifications/balloon_view_views.cc b/chrome/browser/ui/views/notifications/balloon_view_views.cc
index 94716980799b62d26ce1ebfb5661158d4ef435e3..068343b8734e6a4a737356568a6d9e856d572687 100644
--- a/chrome/browser/ui/views/notifications/balloon_view_views.cc
+++ b/chrome/browser/ui/views/notifications/balloon_view_views.cc
@@ -93,14 +93,13 @@ BalloonViewImpl::BalloonViewImpl(BalloonCollection* collection)
frame_container_(NULL),
html_container_(NULL),
html_contents_(NULL),
- method_factory_(this),
close_button_(NULL),
animation_(NULL),
options_menu_model_(NULL),
options_menu_button_(NULL),
- enable_web_ui_(false) {
- // This object is not to be deleted by the views hierarchy,
- // as it is owned by the balloon.
+ enable_web_ui_(false),
+ closed_by_user_(false) {
+ // We're owned by Balloon and don't want to be deleted by our parent View.
set_owned_by_client();
views::BubbleBorder* bubble_border =
@@ -122,12 +121,9 @@ void BalloonViewImpl::Close(bool by_user) {
html_container_->Close();
frame_container_->GetRootView()->RemoveAllChildViews(true);
frame_container_->Close();
- // Post the tast at the end to sure this this WidgetDelegate
- // instance is avaiable when Widget::CloseNow gets called.
- MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&BalloonViewImpl::DelayedClose,
- method_factory_.GetWeakPtr(),
- by_user));
+ closed_by_user_ = by_user;
+ // |frame_container_->::Close()| is async. When processed it'll call back to
+ // DeleteDelegate() and we'll cleanup.
stevenjb 2012/10/16 16:43:41 nit: it will, we will
sky 2012/10/16 16:45:06 What's wrong with contractions?
stevenjb 2012/10/16 16:59:53 Strunk & White says don't use them :) But they can
}
gfx::Size BalloonViewImpl::GetSize() const {
@@ -169,6 +165,10 @@ void BalloonViewImpl::OnWorkAreaChanged() {
collection_->DisplayChanged();
}
+void BalloonViewImpl::DeleteDelegate() {
+ balloon_->OnClose(closed_by_user_);
+}
+
void BalloonViewImpl::ButtonPressed(views::Button* sender,
const ui::Event&) {
// The only button currently is the close button.
@@ -176,10 +176,6 @@ void BalloonViewImpl::ButtonPressed(views::Button* sender,
Close(true);
}
-void BalloonViewImpl::DelayedClose(bool by_user) {
- balloon_->OnClose(by_user);
-}
-
gfx::Size BalloonViewImpl::GetPreferredSize() {
return gfx::Size(1000, 1000);
}
« no previous file with comments | « chrome/browser/ui/views/notifications/balloon_view_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698