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

Unified Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 194108: adds DesktopNotificationService to Profile (Closed)
Patch Set: more feedback 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/renderer_host/render_view_host.cc
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index fdc6d0efca87a96084ee6303c7c390fabc5e6e09..3bf0a93dbd78e27dd86772f0636d3b19b06779dc 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
@@ -833,6 +834,12 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
OnQueryFormFieldAutofill)
IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutofillEntry,
OnRemoveAutofillEntry)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotification,
+ OnShowDesktopNotification)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotificationText,
+ OnShowDesktopNotificationText)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_RequestNotificationPermission,
+ OnRequestNotificationPermission)
IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRequest, OnExtensionRequest)
IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionPostMessage,
@@ -1644,6 +1651,32 @@ void RenderViewHost::ForwardMessageFromExternalHost(const std::string& message,
target));
}
+void RenderViewHost::OnShowDesktopNotification(const GURL& source_origin,
+ const GURL& url, int notification_id) {
+ DesktopNotificationService* service =
+ process()->profile()->GetDesktopNotificationService();
+ service->ShowDesktopNotification(source_origin, url, process()->id(),
+ routing_id(), DesktopNotificationService::PageNotification,
+ notification_id);
+}
+
+void RenderViewHost::OnShowDesktopNotificationText(const GURL& source_origin,
+ const GURL& icon, const string16& title, const string16& text,
+ int notification_id) {
+ DesktopNotificationService* service =
+ process()->profile()->GetDesktopNotificationService();
+ service->ShowDesktopNotificationText(source_origin, icon, title, text,
+ process()->id(), routing_id(),
+ DesktopNotificationService::PageNotification, notification_id);
+}
+
+void RenderViewHost::OnRequestNotificationPermission(
+ const GURL& source_origin, int callback_context) {
+ DesktopNotificationService* service =
+ process()->profile()->GetDesktopNotificationService();
+ service->RequestPermission(source_origin, callback_context);
+}
+
void RenderViewHost::OnExtensionRequest(const std::string& name,
const ListValue& args_holder,
int request_id,

Powered by Google App Engine
This is Rietveld 408576698