summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/balloon.cc
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 21:29:11 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 21:29:11 +0000
commitb52448bbb0eef4eee4cc025562cd04b1c7d530ef (patch)
treee57c73e0f1cc2ace36357bbef0594ad12addd070 /chrome/browser/notifications/balloon.cc
parent48af406a5dc13be98bfef6c902843875399f1033 (diff)
downloadchromium_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/notifications/balloon.cc')
-rw-r--r--chrome/browser/notifications/balloon.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/notifications/balloon.cc b/chrome/browser/notifications/balloon.cc
index 71abe66..d9d4c1f 100644
--- a/chrome/browser/notifications/balloon.cc
+++ b/chrome/browser/notifications/balloon.cc
@@ -36,8 +36,15 @@ void Balloon::Show() {
}
}
-void Balloon::Close(bool by_user) {
+void Balloon::OnClose(bool by_user) {
notification_.Close(by_user);
if (close_listener_)
close_listener_->OnBalloonClosed(this);
}
+
+void Balloon::CloseByScript() {
+ // A user-initiated close begins with the view and then closes this object;
+ // we simulate that with a script-initiated close but pass |by_user|=false.
+ DCHECK(balloon_view_.get());
+ balloon_view_->Close(false);
+}