Index: chrome/browser/notifications/notification.h |
diff --git a/chrome/browser/notifications/notification.h b/chrome/browser/notifications/notification.h |
new file mode 100755 |
index 0000000000000000000000000000000000000000..b4a09709cd1737f1ecadc6e88c535c2453f3ec55 |
--- /dev/null |
+++ b/chrome/browser/notifications/notification.h |
@@ -0,0 +1,58 @@ |
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
+ |
+#include "base/basictypes.h" |
+#include "chrome/browser/notifications/notification_object_proxy.h" |
+#include "googleurl/src/gurl.h" |
+ |
+// Representation of an notification to be shown to the user. All |
+// notifications at this level are HTML, although they may be |
+// data: URLs representing simple text+icon notifications. |
+class Notification { |
+ public: |
+ Notification(const GURL& origin_url, const GURL& content_url, |
+ NotificationObjectProxy* proxy) |
+ : origin_url_(origin_url), |
+ content_url_(content_url), |
+ proxy_(proxy) { |
+ } |
+ |
+ Notification(const Notification& notification) |
+ : origin_url_(notification.origin_url()), |
+ content_url_(notification.content_url()), |
+ proxy_(notification.proxy()) { |
+ } |
+ |
+ // The URL (may be data:) containing the contents for the notification. |
+ const GURL& content_url() const { return content_url_; } |
+ |
+ // The origin URL of the script which requested the notification. |
+ const GURL& origin_url() const { return origin_url_; } |
+ |
+ void Display() const { proxy()->Display(); } |
+ void Error() const { proxy()->Error(); } |
+ void Close(bool by_user) const { proxy()->Close(by_user); } |
+ |
+ private: |
+ NotificationObjectProxy* proxy() const { return proxy_.get(); } |
+ |
+ // The Origin of the page/worker which created this notification. |
+ GURL origin_url_; |
+ |
+ // The URL of the HTML content of the toast (may be a data: URL for simple |
+ // string-based notifications). |
+ GURL content_url_; |
+ |
+ // A proxy object that allows access back to the JavaScript object that |
+ // represents the notification, for firing events. |
+ scoped_refptr<NotificationObjectProxy> proxy_; |
+ |
+ // Disallow assign. Copy constructor written above. |
+ void operator=(const Notification&); |
+}; |
+ |
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |