OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "googleurl/src/gurl.h" |
| 10 #include "notification_object_proxy.h" |
| 11 |
| 12 // Representation of an HTML notification. |
| 13 class Notification { |
| 14 public: |
| 15 Notification(const GURL& origin_url, |
| 16 const GURL& content_url, |
| 17 NotificationObjectProxy* proxy) |
| 18 : origin_url_(origin_url), |
| 19 content_url_(content_url), |
| 20 proxy_(proxy) { |
| 21 } |
| 22 |
| 23 Notification(const Notification& notification) |
| 24 : origin_url_(notification.origin_url()), |
| 25 content_url_(notification.content_url()), |
| 26 proxy_(notification.proxy()) { |
| 27 } |
| 28 |
| 29 const GURL& content_url() const { |
| 30 return content_url_; |
| 31 } |
| 32 |
| 33 const GURL& origin_url() const { |
| 34 return origin_url_; |
| 35 } |
| 36 |
| 37 void display() const { proxy()->display(); } |
| 38 void error() const { proxy()->error(); } |
| 39 void close(bool xplicit) const { proxy()->close(xplicit); } |
| 40 |
| 41 private: |
| 42 NotificationObjectProxy* proxy() const { return proxy_.get(); } |
| 43 |
| 44 // The URL of the page/worker which created this notification. |
| 45 GURL origin_url_; |
| 46 |
| 47 // The URL of the HTML content of the toast (may be a data: URL for simple |
| 48 // string-based notifications). |
| 49 GURL content_url_; |
| 50 |
| 51 // A proxy object that allows access back to the JavaScript object that |
| 52 // represents the notification, for firing events. |
| 53 scoped_refptr<NotificationObjectProxy> proxy_; |
| 54 |
| 55 // Disallow assign. Copy constructor written above. |
| 56 void operator=(const Notification&); |
| 57 }; |
| 58 |
| 59 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ |
OLD | NEW |