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

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

Issue 7125006: Get rid of Chrome notifications dependency, and instead go through ContentBrowserClient to show U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix browsertest Created 9 years, 6 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.cc
===================================================================
--- chrome/browser/notifications/notification_object_proxy.cc (revision 88079)
+++ chrome/browser/notifications/notification_object_proxy.cc (working copy)
@@ -4,11 +4,8 @@
#include "chrome/browser/notifications/notification_object_proxy.h"
-#include "base/message_loop.h"
-#include "base/string16.h"
-#include "content/browser/browser_thread.h"
+#include "base/stringprintf.h"
#include "content/browser/renderer_host/render_view_host.h"
-#include "content/common/desktop_notification_messages.h"
NotificationObjectProxy::NotificationObjectProxy(int process_id, int route_id,
int notification_id, bool worker)
@@ -16,43 +13,37 @@
route_id_(route_id),
notification_id_(notification_id),
worker_(worker) {
+ if (worker_) {
+ // TODO(johnnyg): http://crbug.com/23065 Worker support coming soon.
+ NOTREACHED();
+ }
}
void NotificationObjectProxy::Display() {
- Send(new DesktopNotificationMsg_PostDisplay(route_id_, notification_id_));
+ RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
+ if (host)
+ host->DesktopNotificationPostDisplay(notification_id_);
}
void NotificationObjectProxy::Error() {
- Send(new DesktopNotificationMsg_PostError(
- route_id_, notification_id_, string16()));
+ RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
+ if (host)
+ host->DesktopNotificationPostError(notification_id_, string16());
}
void NotificationObjectProxy::Close(bool by_user) {
- Send(new DesktopNotificationMsg_PostClose(
- route_id_, notification_id_, by_user));
+ RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
+ if (host)
+ host->DesktopNotificationPostClose(notification_id_, by_user);
}
void NotificationObjectProxy::Click() {
- Send(new DesktopNotificationMsg_PostClick(route_id_, notification_id_));
+ RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
+ if (host)
+ host->DesktopNotificationPostClick(notification_id_);
}
std::string NotificationObjectProxy::id() const {
return StringPrintf("%d:%d:%d:%d", process_id_, route_id_,
notification_id_, worker_);
}
-
-
-void NotificationObjectProxy::Send(IPC::Message* message) {
- if (worker_) {
- // TODO(johnnyg): http://crbug.com/23065 Worker support coming soon.
- NOTREACHED();
- return;
- }
-
- RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
- if (host) {
- host->Send(message);
- } else {
- delete message;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698