| 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 #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/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "chrome/browser/chromeos/notifications/balloon_view_host.h" // Message
Callback | 14 #include "chrome/browser/chromeos/notifications/balloon_view_host.h" // Message
Callback |
| 15 #include "chrome/browser/notifications/notification_delegate.h" | 15 #include "chrome/browser/notifications/notification_delegate.h" |
| 16 #include "chromeos/dbus/power_manager_client.h" |
| 16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 17 | 18 |
| 19 class Notification; |
| 18 class Profile; | 20 class Profile; |
| 19 | 21 |
| 20 namespace chromeos { | 22 namespace chromeos { |
| 21 | 23 |
| 22 class BalloonCollectionImplAura; | 24 class BalloonCollectionImplAura; |
| 23 typedef class BalloonCollectionImplAura BalloonCollectionImplType; | 25 typedef class BalloonCollectionImplAura BalloonCollectionImplType; |
| 24 | 26 |
| 25 // The system notification object handles the display of a system notification | 27 // The system notification object handles the display of a system notification |
| 26 | 28 |
| 27 class SystemNotification { | 29 class SystemNotification : public PowerManagerClient::Observer { |
| 28 public: | 30 public: |
| 29 // The profile is the current user profile. The id is any string used | 31 // The profile is the current user profile. The id is any string used |
| 30 // to uniquely identify this notification. The title is the title of | 32 // to uniquely identify this notification. The title is the title of |
| 31 // the message to be displayed. On creation, the message is hidden. | 33 // the message to be displayed. On creation, the message is hidden. |
| 32 SystemNotification(Profile* profile, | 34 SystemNotification(Profile* profile, |
| 33 const std::string& id, | 35 const std::string& id, |
| 34 int icon_resource_id, | 36 int icon_resource_id, |
| 35 const string16& title); | 37 const string16& title); |
| 36 | 38 |
| 37 // Allows to provide custom NotificationDelegate. | 39 // Allows to provide custom NotificationDelegate. |
| 38 SystemNotification(Profile* profile, | 40 SystemNotification(Profile* profile, |
| 39 NotificationDelegate* delegate, | 41 NotificationDelegate* delegate, |
| 40 int icon_resource_id, | 42 int icon_resource_id, |
| 41 const string16& title); | 43 const string16& title); |
| 42 | 44 |
| 43 virtual ~SystemNotification(); | 45 virtual ~SystemNotification(); |
| 44 | 46 |
| 47 // PowerManagerClient::Observer override. |
| 48 virtual void LockScreen() OVERRIDE; |
| 49 virtual void UnlockScreen() OVERRIDE; |
| 50 |
| 45 void set_title(const string16& title) { title_ = title; } | 51 void set_title(const string16& title) { title_ = title; } |
| 46 | 52 |
| 47 // Show will show or update the message for this notification | 53 // Show will show or update the message for this notification |
| 48 // on a transition to urgent, the notification will be shown if it was | 54 // on a transition to urgent, the notification will be shown if it was |
| 49 // previously hidden or minimized by the user. | 55 // previously hidden or minimized by the user. |
| 50 void Show(const string16& message, bool urgent, bool sticky); | 56 void Show(const string16& message, bool urgent, bool sticky); |
| 51 | 57 |
| 52 // Same as Show() above with a footer link at the bottom and a callback | 58 // Same as Show() above with a footer link at the bottom and a callback |
| 53 // for when the link is clicked. | 59 // for when the link is clicked. |
| 54 void Show(const string16& message, const string16& link_text, | 60 void Show(const string16& message, const string16& link_text, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 virtual void Click() OVERRIDE {} | 81 virtual void Click() OVERRIDE {} |
| 76 virtual std::string id() const OVERRIDE; | 82 virtual std::string id() const OVERRIDE; |
| 77 | 83 |
| 78 private: | 84 private: |
| 79 std::string id_; | 85 std::string id_; |
| 80 | 86 |
| 81 DISALLOW_COPY_AND_ASSIGN(Delegate); | 87 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 82 }; | 88 }; |
| 83 | 89 |
| 84 void Init(int icon_resource_id); | 90 void Init(int icon_resource_id); |
| 91 void ShowNotification(const Notification& notify); |
| 85 | 92 |
| 86 Profile* profile_; | 93 Profile* profile_; |
| 87 BalloonCollectionImplType* collection_; | 94 BalloonCollectionImplType* collection_; |
| 88 scoped_refptr<NotificationDelegate> delegate_; | 95 scoped_refptr<NotificationDelegate> delegate_; |
| 96 string16 message_; |
| 97 string16 link_; |
| 98 BalloonViewHost::MessageCallback callback_; |
| 89 GURL icon_; | 99 GURL icon_; |
| 90 string16 title_; | 100 string16 title_; |
| 91 bool visible_; | 101 bool visible_; |
| 102 bool sticky_; |
| 92 bool urgent_; | 103 bool urgent_; |
| 104 bool screen_locked_; |
| 93 | 105 |
| 94 DISALLOW_COPY_AND_ASSIGN(SystemNotification); | 106 DISALLOW_COPY_AND_ASSIGN(SystemNotification); |
| 95 }; | 107 }; |
| 96 | 108 |
| 97 } // namespace chromeos | 109 } // namespace chromeos |
| 98 | 110 |
| 99 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ | 111 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ |
| OLD | NEW |