| 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 30 matching lines...) Expand all Loading... |
| 41 virtual void Display() OVERRIDE { | 41 virtual void Display() OVERRIDE { |
| 42 base::MessageLoop::current()->PostDelayedTask( | 42 base::MessageLoop::current()->PostDelayedTask( |
| 43 FROM_HERE, | 43 FROM_HERE, |
| 44 base::Bind(&CloseBalloon, id()), | 44 base::Bind(&CloseBalloon, id()), |
| 45 base::TimeDelta::FromSeconds(kTimeoutSeconds)); | 45 base::TimeDelta::FromSeconds(kTimeoutSeconds)); |
| 46 } | 46 } |
| 47 virtual void Error() OVERRIDE {} | 47 virtual void Error() OVERRIDE {} |
| 48 virtual void Close(bool by_user) OVERRIDE {} | 48 virtual void Close(bool by_user) OVERRIDE {} |
| 49 virtual void Click() OVERRIDE {} | 49 virtual void Click() OVERRIDE {} |
| 50 virtual std::string id() const OVERRIDE { return id_; } | 50 virtual std::string id() const OVERRIDE { return id_; } |
| 51 virtual content::WebContents* GetWebContents() const OVERRIDE { | |
| 52 return NULL; | |
| 53 } | |
| 54 | 51 |
| 55 private: | 52 private: |
| 56 virtual ~DummyNotificationDelegate() {} | 53 virtual ~DummyNotificationDelegate() {} |
| 57 | 54 |
| 58 std::string id_; | 55 std::string id_; |
| 59 }; | 56 }; |
| 60 | 57 |
| 61 } // anonymous namespace | 58 } // anonymous namespace |
| 62 | 59 |
| 63 int DesktopNotificationBalloon::id_count_ = 1; | 60 int DesktopNotificationBalloon::id_count_ = 1; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 79 // IO access won't be required for normal uses. | 76 // IO access won't be required for normal uses. |
| 80 Profile* profile; | 77 Profile* profile; |
| 81 { | 78 { |
| 82 base::ThreadRestrictions::ScopedAllowIO allow_io; | 79 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 83 profile = ProfileManager::GetLastUsedProfile(); | 80 profile = ProfileManager::GetLastUsedProfile(); |
| 84 } | 81 } |
| 85 notification_id_ = DesktopNotificationService::AddIconNotification( | 82 notification_id_ = DesktopNotificationService::AddIconNotification( |
| 86 GURL(), title, contents, gfx::Image(icon), base::string16(), | 83 GURL(), title, contents, gfx::Image(icon), base::string16(), |
| 87 new DummyNotificationDelegate(base::IntToString(id_count_++)), profile); | 84 new DummyNotificationDelegate(base::IntToString(id_count_++)), profile); |
| 88 } | 85 } |
| OLD | NEW |