Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1150)

Unified Diff: chrome/browser/notifications/notification.h

Issue 271052: Browser side support (sans UI) for desktop notifications.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/notification.h
===================================================================
--- chrome/browser/notifications/notification.h (revision 0)
+++ chrome/browser/notifications/notification.h (revision 0)
@@ -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_
Property changes on: chrome/browser/notifications/notification.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698