| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |