| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/status_icons/desktop_notification_balloon.h" | 5 #include "chrome/browser/status_icons/desktop_notification_balloon.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 explicit DummyNotificationDelegate(const std::string& id, Profile* profile) | 38 explicit DummyNotificationDelegate(const std::string& id, Profile* profile) |
| 39 : id_(kNotificationPrefix + id), profile_(profile) {} | 39 : id_(kNotificationPrefix + id), profile_(profile) {} |
| 40 | 40 |
| 41 void Display() override { | 41 void Display() override { |
| 42 base::MessageLoop::current()->PostDelayedTask( | 42 base::MessageLoop::current()->PostDelayedTask( |
| 43 FROM_HERE, | 43 FROM_HERE, |
| 44 base::Bind( | 44 base::Bind( |
| 45 &CloseBalloon, id(), NotificationUIManager::GetProfileID(profile_)), | 45 &CloseBalloon, id(), NotificationUIManager::GetProfileID(profile_)), |
| 46 base::TimeDelta::FromSeconds(kTimeoutSeconds)); | 46 base::TimeDelta::FromSeconds(kTimeoutSeconds)); |
| 47 } | 47 } |
| 48 void Error() override {} | |
| 49 void Close(bool by_user) override {} | 48 void Close(bool by_user) override {} |
| 50 void Click() override {} | 49 void Click() override {} |
| 51 std::string id() const override { return id_; } | 50 std::string id() const override { return id_; } |
| 52 | 51 |
| 53 private: | 52 private: |
| 54 ~DummyNotificationDelegate() override {} | 53 ~DummyNotificationDelegate() override {} |
| 55 | 54 |
| 56 std::string id_; | 55 std::string id_; |
| 57 Profile* profile_; | 56 Profile* profile_; |
| 58 }; | 57 }; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 85 notification_id_ = DesktopNotificationService::AddIconNotification( | 84 notification_id_ = DesktopNotificationService::AddIconNotification( |
| 86 GURL(), | 85 GURL(), |
| 87 title, | 86 title, |
| 88 contents, | 87 contents, |
| 89 gfx::Image(icon), | 88 gfx::Image(icon), |
| 90 base::string16(), | 89 base::string16(), |
| 91 new DummyNotificationDelegate(base::IntToString(id_count_++), profile_), | 90 new DummyNotificationDelegate(base::IntToString(id_count_++), profile_), |
| 92 profile); | 91 profile); |
| 93 profile_ = profile; | 92 profile_ = profile; |
| 94 } | 93 } |
| OLD | NEW |