| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/move.h" | 11 #include "base/move.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" | 14 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" |
| 15 #include "chrome/browser/notifications/notification_delegate.h" | 15 #include "chrome/browser/notifications/notification_delegate.h" |
| 16 #include "googleurl/src/gurl.h" |
| 16 | 17 |
| 17 class Profile; | 18 class Profile; |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 // The system notification object handles the display of a system notification | 22 // The system notification object handles the display of a system notification |
| 22 | 23 |
| 23 class SystemNotification { | 24 class SystemNotification { |
| 24 public: | 25 public: |
| 25 // The profile is the current user profile. The id is any string used | 26 // The profile is the current user profile. The id is any string used |
| 26 // to uniquely identify this notification. The title is the title of | 27 // to uniquely identify this notification. The title is the title of |
| 27 // the message to be displayed. On creation, the message is hidden. | 28 // the message to be displayed. On creation, the message is hidden. |
| 28 SystemNotification(Profile* profile, std::string id, string16 title); | 29 SystemNotification(Profile* profile, std::string id, int icon_resource_id, |
| 30 string16 title); |
| 29 | 31 |
| 30 ~SystemNotification(); | 32 ~SystemNotification(); |
| 31 | 33 |
| 32 // Show will show or update the message for this notification | 34 // Show will show or update the message for this notification |
| 33 void Show(const string16& message); | 35 // on a transition to urgent, the notification will be shown if it was |
| 36 // previously hidden or minimized by the user. |
| 37 void Show(const string16& message, bool urgent); |
| 34 | 38 |
| 35 // Hide will dismiss the notification, if the notification is already | 39 // Hide will dismiss the notification, if the notification is already |
| 36 // hidden it does nothing | 40 // hidden it does nothing |
| 37 void Hide(); | 41 void Hide(); |
| 38 | 42 |
| 39 // Current visibility state for this notification | 43 // Current visibility state for this notification. |
| 40 bool visible() const { return visible_; } | 44 bool visible() const { return visible_; } |
| 41 | 45 |
| 46 // Current urgent state for this notification. |
| 47 bool urgent() const { return urgent_; } |
| 48 |
| 42 private: | 49 private: |
| 43 class Delegate : public NotificationDelegate { | 50 class Delegate : public NotificationDelegate { |
| 44 public: | 51 public: |
| 45 explicit Delegate(std::string id) : id_(base::move(id)) {} | 52 explicit Delegate(std::string id) : id_(base::move(id)) {} |
| 46 void Display() {} | 53 void Display() {} |
| 47 void Error() {} | 54 void Error() {} |
| 48 void Close(bool by_user) {} | 55 void Close(bool by_user) {} |
| 49 std::string id() const { return id_; } | 56 std::string id() const { return id_; } |
| 50 | 57 |
| 51 private: | 58 private: |
| 52 std::string id_; | 59 std::string id_; |
| 53 | 60 |
| 54 DISALLOW_COPY_AND_ASSIGN(Delegate); | 61 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 55 }; | 62 }; |
| 56 | 63 |
| 57 Profile* profile_; | 64 Profile* profile_; |
| 58 BalloonCollectionImpl* collection_; | 65 BalloonCollectionImpl* collection_; |
| 59 scoped_refptr<Delegate> delegate_; | 66 scoped_refptr<Delegate> delegate_; |
| 67 GURL icon_; |
| 60 string16 title_; | 68 string16 title_; |
| 61 bool visible_; | 69 bool visible_; |
| 70 bool urgent_; |
| 62 | 71 |
| 63 DISALLOW_COPY_AND_ASSIGN(SystemNotification); | 72 DISALLOW_COPY_AND_ASSIGN(SystemNotification); |
| 64 }; | 73 }; |
| 65 | 74 |
| 66 } // namespace chromeos | 75 } // namespace chromeos |
| 67 | 76 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ | 77 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ |
| 69 | 78 |
| OLD | NEW |