| 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/string_number_conversions.h" | 8 #include "base/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 virtual void Display() OVERRIDE { | 42 virtual void Display() OVERRIDE { |
| 43 MessageLoop::current()->PostDelayedTask( | 43 MessageLoop::current()->PostDelayedTask( |
| 44 FROM_HERE, | 44 FROM_HERE, |
| 45 base::Bind(&CloseBalloon, id()), | 45 base::Bind(&CloseBalloon, id()), |
| 46 base::TimeDelta::FromSeconds(kTimeoutSeconds)); | 46 base::TimeDelta::FromSeconds(kTimeoutSeconds)); |
| 47 } | 47 } |
| 48 virtual void Error() OVERRIDE {} | 48 virtual void Error() OVERRIDE {} |
| 49 virtual void Close(bool by_user) OVERRIDE {} | 49 virtual void Close(bool by_user) OVERRIDE {} |
| 50 virtual void Click() OVERRIDE {} | 50 virtual void Click() OVERRIDE {} |
| 51 virtual std::string id() const OVERRIDE { return id_; } | 51 virtual std::string id() const OVERRIDE { return id_; } |
| 52 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE { |
| 53 return NULL; |
| 54 } |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 virtual ~DummyNotificationDelegate() {} | 57 virtual ~DummyNotificationDelegate() {} |
| 55 | 58 |
| 56 std::string id_; | 59 std::string id_; |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 } // anonymous namespace | 62 } // anonymous namespace |
| 60 | 63 |
| 61 int DesktopNotificationBalloon::id_count_ = 1; | 64 int DesktopNotificationBalloon::id_count_ = 1; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 82 GURL(), content_url, string16(), string16(), | 85 GURL(), content_url, string16(), string16(), |
| 83 new DummyNotificationDelegate(base::IntToString(id_count_++)))); | 86 new DummyNotificationDelegate(base::IntToString(id_count_++)))); |
| 84 | 87 |
| 85 // Allowing IO access is required here to cover the corner case where | 88 // Allowing IO access is required here to cover the corner case where |
| 86 // there is no last used profile and the default one is loaded. | 89 // there is no last used profile and the default one is loaded. |
| 87 // IO access won't be required for normal uses. | 90 // IO access won't be required for normal uses. |
| 88 base::ThreadRestrictions::ScopedAllowIO allow_io; | 91 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 89 g_browser_process->notification_ui_manager()->Add( | 92 g_browser_process->notification_ui_manager()->Add( |
| 90 *notification_.get(), ProfileManager::GetLastUsedProfile()); | 93 *notification_.get(), ProfileManager::GetLastUsedProfile()); |
| 91 } | 94 } |
| OLD | NEW |