| Index: content/browser/renderer_host/render_message_filter.cc
|
| diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
|
| index 29e1e1f199a4d0cfe286083e5f870ecdcd337bcf..53826b4d5aa26fda84621ebc7d03c432230528ed 100644
|
| --- a/content/browser/renderer_host/render_message_filter.cc
|
| +++ b/content/browser/renderer_host/render_message_filter.cc
|
| @@ -130,6 +130,21 @@ class RenderMessageCompletionCallback {
|
| IPC::Message* reply_msg_;
|
| };
|
|
|
| +class CheckNotificationPermissionCallback
|
| + : public RenderMessageCompletionCallback {
|
| + public:
|
| + CheckNotificationPermissionCallback(RenderMessageFilter* filter,
|
| + IPC::Message* reply_msg)
|
| + : RenderMessageCompletionCallback(filter, reply_msg) {}
|
| +
|
| + void GotNotificationPermission(
|
| + WebKit::WebNotificationPresenter::Permission permission) {
|
| + DesktopNotificationHostMsg_CheckPermission::WriteReplyParams(
|
| + reply_msg(), static_cast<int>(permission));
|
| + SendReplyAndDeleteThis();
|
| + }
|
| +};
|
| +
|
| class OpenChannelToPpapiPluginCallback
|
| : public RenderMessageCompletionCallback,
|
| public PpapiPluginProcessHost::PluginClient {
|
| @@ -396,8 +411,8 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
|
| IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_UpdateRect,
|
| render_widget_helper_->DidReceiveBackingStoreMsg(message))
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed)
|
| - IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_CheckPermission,
|
| - OnCheckNotificationPermission)
|
| + IPC_MESSAGE_HANDLER_DELAY_REPLY(DesktopNotificationHostMsg_CheckPermission,
|
| + OnCheckNotificationPermission)
|
| IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory,
|
| OnAllocateSharedMemory)
|
| #if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID)
|
| @@ -850,13 +865,27 @@ void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message,
|
| }
|
|
|
| void RenderMessageFilter::OnCheckNotificationPermission(
|
| - const GURL& source_origin, int* result) {
|
| + const GURL& source_origin,
|
| + IPC::Message* reply_msg) {
|
| + // |callback| will delete itself when GotNotificationPermission is called.
|
| + CheckNotificationPermissionCallback* callback =
|
| + new CheckNotificationPermissionCallback(this, reply_msg);
|
| +
|
| #if defined(ENABLE_NOTIFICATIONS)
|
| - *result = GetContentClient()->browser()->
|
| - CheckDesktopNotificationPermission(source_origin, resource_context_,
|
| - render_process_id_);
|
| + BrowserThread::PostTaskAndReplyWithResult(
|
| + BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&ContentBrowserClient::CheckDesktopNotificationPermission,
|
| + base::Unretained(GetContentClient()->browser()), // XXX TODO
|
| + source_origin,
|
| + resource_context_,
|
| + render_process_id_),
|
| + base::Bind(
|
| + &CheckNotificationPermissionCallback::GotNotificationPermission,
|
| + base::Unretained(callback)));
|
| #else
|
| - *result = WebKit::WebNotificationPresenter::PermissionAllowed;
|
| + callback->GotNotificationPermission(
|
| + WebKit::WebNotificationPresenter::PermissionAllowed);
|
| #endif
|
| }
|
|
|
|
|