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

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

Issue 208068: Desktop Notifications UI (for windows) (Closed)
Patch Set: Created 11 years, 3 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_object_proxy.h
diff --git a/chrome/browser/notifications/notification_object_proxy.h b/chrome/browser/notifications/notification_object_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..e3fb2e00052d98df617af6ec8364461d3ba5eb41
--- /dev/null
+++ b/chrome/browser/notifications/notification_object_proxy.h
@@ -0,0 +1,53 @@
+// 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_OBJECT_PROXY_H_
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
+
+#include "base/ref_counted.h"
+
+class MessageLoop;
+namespace IPC {
+ class Message;
+}
+
+// A NotificationObjectProxy stands in for the JavaScript Notification object
+// which corresponds to an actual desktop notification. It can be signaled
+// when various events occur regarding the desktop notification, and the
+// attached JS listeners will be invoked in the renderer or worker process.
+//
+// This class should be accessed only on the UI thread.
+class NotificationObjectProxy :
+ public base::RefCounted<NotificationObjectProxy> {
+ public:
+ // Creates a Proxy object with the necessary callback information.
+ NotificationObjectProxy(int process_id, int route_id,
+ int notification_id_, bool worker);
+
+ // To be called when the desktop notification is actually shown.
+ void display();
+
+ // To be called when the desktop notification cannot be shown due to an
+ // error.
+ void error();
+
+ // To be called when the desktop notification is closed. If closed by a
+ // user explicitly (as opposed to timeout), |by_user| should be true.
+ void close(bool by_user);
+
+ private:
+ // Called on UI thread to schedule a message for sending.
+ void DeliverMessage(IPC::Message* message);
+
+ // Called via Task on IO thread to actually send a message to a notification.
+ void Send(IPC::Message* message);
+
+ // Callback information to find the JS Notification object where it lives.
+ int process_id_;
+ int route_id_;
+ int notification_id_;
+ bool worker_;
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
« no previous file with comments | « chrome/browser/notifications/notification.h ('k') | chrome/browser/notifications/notification_object_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698