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

Unified Diff: content/renderer/notification_provider.cc

Issue 95223003: Remove plumbing for showing HTML notifications from content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « content/renderer/notification_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/notification_provider.cc
diff --git a/content/renderer/notification_provider.cc b/content/renderer/notification_provider.cc
index 687eceb5b54df08432b8bba71604bfdb95c30e68..07b5241aec615192c602de22356566c6e52bbbbc 100644
--- a/content/renderer/notification_provider.cc
+++ b/content/renderer/notification_provider.cc
@@ -35,11 +35,18 @@ NotificationProvider::~NotificationProvider() {
}
bool NotificationProvider::show(const WebNotification& notification) {
+ WebDocument document = render_view()->GetWebView()->mainFrame()->document();
int notification_id = manager_.RegisterNotification(notification);
- if (notification.isHTML())
- return ShowHTML(notification, notification_id);
- else
- return ShowText(notification, notification_id);
+
+ ShowDesktopNotificationHostMsgParams params;
+ params.origin = GURL(document.securityOrigin().toString());
+ params.icon_url = notification.iconURL();
+ params.title = notification.title();
+ params.body = notification.body();
+ params.direction = notification.direction();
+ params.notification_id = notification_id;
+ params.replace_id = notification.replaceId();
+ return Send(new DesktopNotificationHostMsg_Show(routing_id(), params));
}
void NotificationProvider::cancel(const WebNotification& notification) {
@@ -100,35 +107,6 @@ bool NotificationProvider::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-bool NotificationProvider::ShowHTML(const WebNotification& notification,
- int id) {
- DCHECK(notification.isHTML());
- ShowDesktopNotificationHostMsgParams params;
- WebDocument document = render_view()->GetWebView()->mainFrame()->document();
- params.origin = GURL(document.securityOrigin().toString());
- params.is_html = true;
- params.contents_url = notification.url();
- params.notification_id = id;
- params.replace_id = notification.replaceId();
- return Send(new DesktopNotificationHostMsg_Show(routing_id(), params));
-}
-
-bool NotificationProvider::ShowText(const WebNotification& notification,
- int id) {
- DCHECK(!notification.isHTML());
- ShowDesktopNotificationHostMsgParams params;
- params.is_html = false;
- WebDocument document = render_view()->GetWebView()->mainFrame()->document();
- params.origin = GURL(document.securityOrigin().toString());
- params.icon_url = notification.iconURL();
- params.title = notification.title();
- params.body = notification.body();
- params.direction = notification.direction();
- params.notification_id = id;
- params.replace_id = notification.replaceId();
- return Send(new DesktopNotificationHostMsg_Show(routing_id(), params));
-}
-
void NotificationProvider::OnDisplay(int id) {
WebNotification notification;
bool found = manager_.GetNotification(id, &notification);
« no previous file with comments | « content/renderer/notification_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698