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

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
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c298997eb986b45943251afebb0eb6a85b316db7..93263bbc2ed49439912c9a1cfb5afdd6aedf25da 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 {
@@ -60,11 +61,15 @@ 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 {
+ *permission = blink::WebNotificationPermissionDenied;
+ }
}
void NotificationMessageFilter::OnShowPlatformNotification(
@@ -73,11 +78,15 @@ 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();
+ DCHECK(service);
+
+ service->DisplayNotification(browser_context_,
+ params,
+ delegate.Pass(),
+ process_id_,
+ &close_closure);
if (!close_closure.is_null())
close_closures_[notification_id] = close_closure;
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698