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

Side by Side Diff: chrome/browser/notifications/balloon.cc

Issue 363003: Implement cancel() API on a Notification object so that script can cancel or ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/balloon.h" 5 #include "chrome/browser/notifications/balloon.h"
6 6
7 #include "base/gfx/rect.h" 7 #include "base/gfx/rect.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/notifications/balloon_collection.h" 9 #include "chrome/browser/notifications/balloon_collection.h"
10 #include "chrome/browser/renderer_host/site_instance.h" 10 #include "chrome/browser/renderer_host/site_instance.h"
(...skipping 18 matching lines...) Expand all
29 balloon_view_.reset(balloon_view); 29 balloon_view_.reset(balloon_view);
30 } 30 }
31 31
32 void Balloon::Show() { 32 void Balloon::Show() {
33 notification_.Display(); 33 notification_.Display();
34 if (balloon_view_.get()) { 34 if (balloon_view_.get()) {
35 balloon_view_->Show(this); 35 balloon_view_->Show(this);
36 } 36 }
37 } 37 }
38 38
39 void Balloon::Close(bool by_user) { 39 void Balloon::OnClose(bool by_user) {
40 notification_.Close(by_user); 40 notification_.Close(by_user);
41 if (close_listener_) 41 if (close_listener_)
42 close_listener_->OnBalloonClosed(this); 42 close_listener_->OnBalloonClosed(this);
43 } 43 }
44
45 void Balloon::CloseByScript() {
46 // A user-initiated close begins with the view and then closes this object;
47 // we simulate that with a script-initiated close but pass |by_user|=false.
48 DCHECK(balloon_view_.get());
49 balloon_view_->Close(false);
50 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/balloon.h ('k') | chrome/browser/notifications/balloon_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698