| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> |
| 10 |
| 9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 10 #include "chrome/browser/notifications/notification_object_proxy.h" | 12 #include "chrome/browser/notifications/notification_object_proxy.h" |
| 11 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 12 | 14 |
| 13 class NotificationDelegate; | 15 class NotificationDelegate; |
| 14 | 16 |
| 15 // Representation of an notification to be shown to the user. All | 17 // Representation of an notification to be shown to the user. All |
| 16 // notifications at this level are HTML, although they may be | 18 // notifications at this level are HTML, although they may be |
| 17 // data: URLs representing simple text+icon notifications. | 19 // data: URLs representing simple text+icon notifications. |
| 18 class Notification { | 20 class Notification { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 // A display string for the source of the notification. | 37 // A display string for the source of the notification. |
| 36 const string16& display_source() const { return display_source_; } | 38 const string16& display_source() const { return display_source_; } |
| 37 | 39 |
| 38 const string16& replace_id() const { return replace_id_; } | 40 const string16& replace_id() const { return replace_id_; } |
| 39 | 41 |
| 40 void Display() const { delegate()->Display(); } | 42 void Display() const { delegate()->Display(); } |
| 41 void Error() const { delegate()->Error(); } | 43 void Error() const { delegate()->Error(); } |
| 42 void Click() const { delegate()->Click(); } | 44 void Click() const { delegate()->Click(); } |
| 43 void Close(bool by_user) const { delegate()->Close(by_user); } | 45 void Close(bool by_user) const { delegate()->Close(by_user); } |
| 44 | 46 |
| 45 bool IsSame(const Notification& other) const; | 47 std::string notification_id() const { return delegate()->id(); } |
| 46 | 48 |
| 47 private: | 49 private: |
| 48 NotificationDelegate* delegate() const { return delegate_.get(); } | 50 NotificationDelegate* delegate() const { return delegate_.get(); } |
| 49 | 51 |
| 50 // The Origin of the page/worker which created this notification. | 52 // The Origin of the page/worker which created this notification. |
| 51 GURL origin_url_; | 53 GURL origin_url_; |
| 52 | 54 |
| 53 // The URL of the HTML content of the toast (may be a data: URL for simple | 55 // The URL of the HTML content of the toast (may be a data: URL for simple |
| 54 // string-based notifications). | 56 // string-based notifications). |
| 55 GURL content_url_; | 57 GURL content_url_; |
| 56 | 58 |
| 57 // The display string for the source of the notification. Could be | 59 // The display string for the source of the notification. Could be |
| 58 // the same as origin_url_, or the name of an extension. | 60 // the same as origin_url_, or the name of an extension. |
| 59 string16 display_source_; | 61 string16 display_source_; |
| 60 | 62 |
| 61 // The replace ID for the notification. | 63 // The replace ID for the notification. |
| 62 string16 replace_id_; | 64 string16 replace_id_; |
| 63 | 65 |
| 64 // A proxy object that allows access back to the JavaScript object that | 66 // A proxy object that allows access back to the JavaScript object that |
| 65 // represents the notification, for firing events. | 67 // represents the notification, for firing events. |
| 66 scoped_refptr<NotificationDelegate> delegate_; | 68 scoped_refptr<NotificationDelegate> delegate_; |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ | 71 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
| OLD | NEW |