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_NOTIFICATIONS_NOTIFICATION_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_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/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/notifications/notification_delegate.h" | 14 #include "chrome/browser/notifications/notification_delegate.h" |
15 #include "third_party/WebKit/public/web/WebTextDirection.h" | 15 #include "third_party/WebKit/public/web/WebTextDirection.h" |
16 #include "ui/gfx/image/image.h" | |
17 #include "ui/message_center/notification.h" | 16 #include "ui/message_center/notification.h" |
18 #include "ui/message_center/notification_types.h" | 17 #include "ui/message_center/notification_types.h" |
19 #include "url/gurl.h" | 18 #include "url/gurl.h" |
20 | 19 |
| 20 namespace gfx { |
| 21 class Image; |
| 22 } |
| 23 |
21 // Representation of a notification to be shown to the user. | 24 // Representation of a notification to be shown to the user. |
22 // On non-Ash platforms these are rendered as HTML, sometimes described by a | 25 // On non-Ash platforms these are rendered as HTML, sometimes described by a |
23 // data url converted from text + icon data. On Ash they are rendered as | 26 // data url converted from text + icon data. On Ash they are rendered as |
24 // formated text and icon data. | 27 // formated text and icon data. |
25 class Notification : public message_center::Notification { | 28 class Notification : public message_center::Notification { |
26 public: | 29 public: |
27 // Initializes a notification with text content. On non-ash platforms, this | 30 // Initializes a notification with text content. On non-ash platforms, this |
28 // creates an HTML representation using a data: URL for display. | 31 // creates an HTML representation using a data: URL for display. |
29 Notification(const GURL& origin_url, | 32 Notification(const GURL& origin_url, |
30 const GURL& icon_url, | 33 const GURL& icon_url, |
(...skipping 25 matching lines...) Expand all Loading... |
56 const message_center::NotifierId& notifier_id, | 59 const message_center::NotifierId& notifier_id, |
57 const base::string16& display_source, | 60 const base::string16& display_source, |
58 const base::string16& replace_id, | 61 const base::string16& replace_id, |
59 const message_center::RichNotificationData& rich_notification_data, | 62 const message_center::RichNotificationData& rich_notification_data, |
60 NotificationDelegate* delegate); | 63 NotificationDelegate* delegate); |
61 | 64 |
62 Notification(const Notification& notification); | 65 Notification(const Notification& notification); |
63 virtual ~Notification(); | 66 virtual ~Notification(); |
64 Notification& operator=(const Notification& notification); | 67 Notification& operator=(const Notification& notification); |
65 | 68 |
66 // The URL (may be data:) containing the contents for the notification. | |
67 const GURL& content_url() const { return content_url_; } | |
68 | |
69 // The origin URL of the script which requested the notification. | 69 // The origin URL of the script which requested the notification. |
70 const GURL& origin_url() const { return origin_url_; } | 70 const GURL& origin_url() const { return origin_url_; } |
71 | 71 |
72 // A url for the icon to be shown (optional). | 72 // A url for the icon to be shown (optional). |
73 const GURL& icon_url() const { return icon_url_; } | 73 const GURL& icon_url() const { return icon_url_; } |
74 | 74 |
75 // A unique identifier used to update (replace) or remove a notification. | 75 // A unique identifier used to update (replace) or remove a notification. |
76 const base::string16& replace_id() const { return replace_id_; } | 76 const base::string16& replace_id() const { return replace_id_; } |
77 | 77 |
78 // A url for the button icons to be shown (optional). | 78 // A url for the button icons to be shown (optional). |
(...skipping 15 matching lines...) Expand all Loading... |
94 NotificationDelegate* delegate() const { return delegate_.get(); } | 94 NotificationDelegate* delegate() const { return delegate_.get(); } |
95 | 95 |
96 private: | 96 private: |
97 // The Origin of the page/worker which created this notification. | 97 // The Origin of the page/worker which created this notification. |
98 GURL origin_url_; | 98 GURL origin_url_; |
99 | 99 |
100 // URL for the icon associated with the notification. Requires delegate_ | 100 // URL for the icon associated with the notification. Requires delegate_ |
101 // to have a non NULL RenderViewHost. | 101 // to have a non NULL RenderViewHost. |
102 GURL icon_url_; | 102 GURL icon_url_; |
103 | 103 |
104 // The URL of the HTML content of the toast (may be a data: URL for simple | |
105 // string-based notifications). | |
106 GURL content_url_; | |
107 | |
108 // The URLs of the button images for a rich notification. | 104 // The URLs of the button images for a rich notification. |
109 GURL button_one_icon_url_; | 105 GURL button_one_icon_url_; |
110 GURL button_two_icon_url_; | 106 GURL button_two_icon_url_; |
111 | 107 |
112 // The URL of a large image to be displayed for a a rich notification. | 108 // The URL of a large image to be displayed for a a rich notification. |
113 GURL image_url_; | 109 GURL image_url_; |
114 | 110 |
115 // The URL of a small image to be displayed for a a rich notification. | 111 // The URL of a small image to be displayed for a a rich notification. |
116 GURL small_image_url_; | 112 GURL small_image_url_; |
117 | 113 |
118 // The user-supplied replace ID for the notification. | 114 // The user-supplied replace ID for the notification. |
119 base::string16 replace_id_; | 115 base::string16 replace_id_; |
120 | 116 |
121 // A proxy object that allows access back to the JavaScript object that | 117 // A proxy object that allows access back to the JavaScript object that |
122 // represents the notification, for firing events. | 118 // represents the notification, for firing events. |
123 scoped_refptr<NotificationDelegate> delegate_; | 119 scoped_refptr<NotificationDelegate> delegate_; |
124 }; | 120 }; |
125 | 121 |
126 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ | 122 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
OLD | NEW |