Index: content/shell/browser/shell_message_filter.cc |
diff --git a/content/shell/browser/shell_message_filter.cc b/content/shell/browser/shell_message_filter.cc |
index b2008b31ad278bec6ffd9a52ee095a8a4e9b5533..36929609d36428ac80d551fcbce1e0b5a94ae146 100644 |
--- a/content/shell/browser/shell_message_filter.cc |
+++ b/content/shell/browser/shell_message_filter.cc |
@@ -10,6 +10,7 @@ |
#include "content/shell/browser/shell_browser_context.h" |
#include "content/shell/browser/shell_content_browser_client.h" |
#include "content/shell/browser/shell_network_delegate.h" |
+#include "content/shell/browser/shell_notification_manager.h" |
#include "content/shell/common/shell_messages.h" |
#include "net/base/net_errors.h" |
#include "net/cookies/cookie_monster.h" |
@@ -50,6 +51,12 @@ bool ShellMessageFilter::OnMessageReceived(const IPC::Message& message) { |
OnRegisterIsolatedFileSystem) |
IPC_MESSAGE_HANDLER(ShellViewHostMsg_ClearAllDatabases, OnClearAllDatabases) |
IPC_MESSAGE_HANDLER(ShellViewHostMsg_SetDatabaseQuota, OnSetDatabaseQuota) |
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_CheckWebNotificationPermission, |
+ OnCheckWebNotificationPermission) |
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_GrantWebNotificationPermission, |
+ OnGrantWebNotificationPermission) |
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_ClearWebNotificationPermissions, |
+ OnClearWebNotificationPermissions) |
IPC_MESSAGE_HANDLER(ShellViewHostMsg_AcceptAllCookies, OnAcceptAllCookies) |
IPC_MESSAGE_HANDLER(ShellViewHostMsg_DeleteAllCookies, OnDeleteAllCookies) |
IPC_MESSAGE_UNHANDLED(handled = false) |
@@ -92,6 +99,34 @@ void ShellMessageFilter::OnSetDatabaseQuota(int quota) { |
quota::QuotaCallback()); |
} |
+void ShellMessageFilter::OnCheckWebNotificationPermission(const GURL& origin, |
+ int* result) { |
+ ShellNotificationManager* manager = |
+ ShellContentBrowserClient::Get()->GetShellNotificationManager(); |
+ if (manager) |
+ *result = manager->CheckPermission(origin); |
+ else |
+ *result = blink::WebNotificationPresenter::PermissionAllowed; |
+} |
+ |
+void ShellMessageFilter::OnGrantWebNotificationPermission( |
+ const GURL& origin, bool permission_granted) { |
+ ShellNotificationManager* manager = |
+ ShellContentBrowserClient::Get()->GetShellNotificationManager(); |
+ if (manager) { |
+ manager->SetPermission(origin, permission_granted ? |
+ blink::WebNotificationPresenter::PermissionAllowed : |
+ blink::WebNotificationPresenter::PermissionDenied); |
+ } |
+} |
+ |
+void ShellMessageFilter::OnClearWebNotificationPermissions() { |
+ ShellNotificationManager* manager = |
+ ShellContentBrowserClient::Get()->GetShellNotificationManager(); |
+ if (manager) |
+ manager->ClearPermissions(); |
+} |
+ |
void ShellMessageFilter::OnAcceptAllCookies(bool accept) { |
ShellNetworkDelegate::SetAcceptAllCookies(accept); |
} |