diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 21:29:11 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 21:29:11 +0000 |
commit | b52448bbb0eef4eee4cc025562cd04b1c7d530ef (patch) | |
tree | e57c73e0f1cc2ace36357bbef0594ad12addd070 /chrome/browser/views/notifications | |
parent | 48af406a5dc13be98bfef6c902843875399f1033 (diff) | |
download | chromium_src-b52448bbb0eef4eee4cc025562cd04b1c7d530ef.zip chromium_src-b52448bbb0eef4eee4cc025562cd04b1c7d530ef.tar.gz chromium_src-b52448bbb0eef4eee4cc025562cd04b1c7d530ef.tar.bz2 |
Implement cancel() API on a Notification object so that script can cancel or tear down a toast.
BUG=26360
TEST=cancel a notification
Review URL: http://codereview.chromium.org/363003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/notifications')
-rw-r--r-- | chrome/browser/views/notifications/balloon_view.cc | 17 | ||||
-rw-r--r-- | chrome/browser/views/notifications/balloon_view.h | 4 |
2 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/views/notifications/balloon_view.cc b/chrome/browser/views/notifications/balloon_view.cc index cb0ef1e..43a8554 100644 --- a/chrome/browser/views/notifications/balloon_view.cc +++ b/chrome/browser/views/notifications/balloon_view.cc @@ -71,7 +71,7 @@ class BalloonCloseButtonListener : public views::ButtonListener { // The only button currently is the close button. virtual void ButtonPressed(views::Button* sender, const views::Event&) { - view_->Close(); + view_->Close(true); } private: @@ -110,16 +110,17 @@ BalloonViewImpl::BalloonViewImpl() BalloonViewImpl::~BalloonViewImpl() { } -void BalloonViewImpl::Close() { +void BalloonViewImpl::Close(bool by_user) { MessageLoop::current()->PostTask(FROM_HERE, - method_factory_.NewRunnableMethod(&BalloonViewImpl::DelayedClose)); + method_factory_.NewRunnableMethod( + &BalloonViewImpl::DelayedClose, by_user)); } -void BalloonViewImpl::DelayedClose() { +void BalloonViewImpl::DelayedClose(bool by_user) { html_contents_->Shutdown(); html_container_->CloseNow(); frame_container_->CloseNow(); - balloon_->Close(true); + balloon_->OnClose(by_user); } void BalloonViewImpl::DidChangeBounds(const gfx::Rect& previous, @@ -339,8 +340,8 @@ void BalloonViewImpl::Paint(gfx::Canvas* canvas) { } void BalloonViewImpl::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { + const NotificationSource& source, + const NotificationDetails& details) { if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) { NOTREACHED(); return; @@ -350,5 +351,5 @@ void BalloonViewImpl::Observe(NotificationType type, // (e.g., because of a crash), we want to close the balloon. notification_registrar_.Remove(this, NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); - Close(); + Close(false); } diff --git a/chrome/browser/views/notifications/balloon_view.h b/chrome/browser/views/notifications/balloon_view.h index 35f6db2..0d7dd0a 100644 --- a/chrome/browser/views/notifications/balloon_view.h +++ b/chrome/browser/views/notifications/balloon_view.h @@ -45,7 +45,7 @@ class BalloonViewImpl : public BalloonView, // BalloonView interface. void Show(Balloon* balloon); void RepositionToBalloon(); - void Close(); + void Close(bool by_user); private: // Overridden from views::View. @@ -72,7 +72,7 @@ class BalloonViewImpl : public BalloonView, void SizeContentsWindow(); // Do the delayed close work. - void DelayedClose(); + void DelayedClose(bool by_user); // The height of the balloon's shelf. // The shelf is where is close button is located. |