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

Unified Diff: content/browser/notifications/notification_message_filter.cc

Issue 774573003: Start pulling away notification logic from ChromeContentBrowserClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: content/browser/notifications/notification_message_filter.cc
diff --git a/content/browser/notifications/notification_message_filter.cc b/content/browser/notifications/notification_message_filter.cc
index fecd0730b77f8b5bafc47ec04e0ef70cbf8d0ebd..c1c5b297066ba2b33598fb7c3373cd53548b9570 100644
--- a/content/browser/notifications/notification_message_filter.cc
+++ b/content/browser/notifications/notification_message_filter.cc
@@ -11,6 +11,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/desktop_notification_delegate.h"
+#include "content/public/browser/platform_notification_service.h"
#include "content/public/common/content_client.h"
namespace content {
@@ -54,11 +55,14 @@ void NotificationMessageFilter::OverrideThreadForMessage(
void NotificationMessageFilter::OnCheckNotificationPermission(
const GURL& origin, blink::WebNotificationPermission* permission) {
- *permission =
- GetContentClient()->browser()->CheckDesktopNotificationPermission(
- origin,
- resource_context_,
- process_id_);
+ PlatformNotificationService* service =
+ GetContentClient()->browser()->GetPlatformNotificationService();
+ if (service) {
+ *permission = service->CheckPermission(resource_context_,
+ origin,
+ process_id_);
+ } else
dewittj 2014/12/02 17:22:59 nit: braces around else clause
Peter Beverloo 2014/12/05 20:03:43 Done.
+ *permission = blink::WebNotificationPermissionDenied;
}
void NotificationMessageFilter::OnShowPlatformNotification(
@@ -67,11 +71,14 @@ void NotificationMessageFilter::OnShowPlatformNotification(
new PageNotificationDelegate(process_id_, notification_id));
base::Closure close_closure;
- GetContentClient()->browser()->ShowDesktopNotification(params,
- browser_context_,
- process_id_,
- delegate.Pass(),
- &close_closure);
+ PlatformNotificationService* service =
+ GetContentClient()->browser()->GetPlatformNotificationService();
+
+ service->DisplayNotification(browser_context_,
+ params,
+ delegate.Pass(),
+ process_id_,
+ &close_closure);
if (!close_closure.is_null())
close_closures_[notification_id] = close_closure;

Powered by Google App Engine
This is Rietveld 408576698