| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.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 #include "googleurl/src/gurl.h" |
| 17 | 17 |
| 18 class MessageCallback; | 18 class MessageCallback; |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 // The system notification object handles the display of a system notification | 23 // The system notification object handles the display of a system notification |
| 24 | 24 |
| 25 class SystemNotification { | 25 class SystemNotification { |
| 26 public: | 26 public: |
| 27 // The profile is the current user profile. The id is any string used | 27 // The profile is the current user profile. The id is any string used |
| 28 // to uniquely identify this notification. The title is the title of | 28 // to uniquely identify this notification. The title is the title of |
| 29 // the message to be displayed. On creation, the message is hidden. | 29 // the message to be displayed. On creation, the message is hidden. |
| 30 SystemNotification(Profile* profile, const std::string& id, | 30 SystemNotification(Profile* profile, |
| 31 const std::string& id, |
| 31 int icon_resource_id, | 32 int icon_resource_id, |
| 32 const string16& title); | 33 const string16& title); |
| 33 | 34 |
| 35 // Allows to provide custom NotificationDelegate. |
| 36 SystemNotification(Profile* profile, |
| 37 NotificationDelegate* delegate, |
| 38 int icon_resource_id, |
| 39 const string16& title); |
| 40 |
| 34 virtual ~SystemNotification(); | 41 virtual ~SystemNotification(); |
| 35 | 42 |
| 36 void set_title(const string16& title) { title_ = title; } | 43 void set_title(const string16& title) { title_ = title; } |
| 37 | 44 |
| 38 // Show will show or update the message for this notification | 45 // Show will show or update the message for this notification |
| 39 // on a transition to urgent, the notification will be shown if it was | 46 // on a transition to urgent, the notification will be shown if it was |
| 40 // previously hidden or minimized by the user. | 47 // previously hidden or minimized by the user. |
| 41 void Show(const string16& message, bool urgent, bool sticky); | 48 void Show(const string16& message, bool urgent, bool sticky); |
| 42 | 49 |
| 43 // Same as Show() above with a footer link at the bottom and a callback | 50 // Same as Show() above with a footer link at the bottom and a callback |
| (...skipping 20 matching lines...) Expand all Loading... |
| 64 void Close(bool by_user) {} | 71 void Close(bool by_user) {} |
| 65 void Click() {} | 72 void Click() {} |
| 66 std::string id() const { return id_; } | 73 std::string id() const { return id_; } |
| 67 | 74 |
| 68 private: | 75 private: |
| 69 std::string id_; | 76 std::string id_; |
| 70 | 77 |
| 71 DISALLOW_COPY_AND_ASSIGN(Delegate); | 78 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 72 }; | 79 }; |
| 73 | 80 |
| 81 void Init(int icon_resource_id); |
| 82 |
| 74 Profile* profile_; | 83 Profile* profile_; |
| 75 BalloonCollectionImpl* collection_; | 84 BalloonCollectionImpl* collection_; |
| 76 scoped_refptr<Delegate> delegate_; | 85 scoped_refptr<NotificationDelegate> delegate_; |
| 77 GURL icon_; | 86 GURL icon_; |
| 78 string16 title_; | 87 string16 title_; |
| 79 bool visible_; | 88 bool visible_; |
| 80 bool urgent_; | 89 bool urgent_; |
| 81 | 90 |
| 82 DISALLOW_COPY_AND_ASSIGN(SystemNotification); | 91 DISALLOW_COPY_AND_ASSIGN(SystemNotification); |
| 83 }; | 92 }; |
| 84 | 93 |
| 85 } // namespace chromeos | 94 } // namespace chromeos |
| 86 | 95 |
| 87 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ | 96 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ |
| OLD | NEW |