Chromium Code Reviews| Index: content/browser/renderer_host/url_handling_message_filter.cc |
| diff --git a/content/browser/renderer_host/url_handling_message_filter.cc b/content/browser/renderer_host/url_handling_message_filter.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2cdbd3c99f157560646d137909cff1d91ffd6955 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/url_handling_message_filter.cc |
| @@ -0,0 +1,65 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/renderer_host/url_handling_message_filter.h" |
| + |
| +#include "content/public/browser/browser_message_filter.h" |
| +#include "content/public/browser/notification_service.h" |
| +#include "content/public/browser/notification_source.h" |
| +#include "content/public/browser/notification_types.h" |
| +#include "content/public/browser/render_process_host.h" |
| +#include "content/public/browser/url_handling_notifications.h" |
| +#include "content/public/common/url_handling_messages.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "ipc/ipc_message_macros.h" |
| +#include "content/public/browser/browser_thread.h" |
| + |
| +namespace content { |
| + |
| +UrlHandlingMessageFilter::UrlHandlingMessageFilter( |
| + RenderProcessHost* render_process_host) |
| + : render_process_host_(render_process_host) { |
| +} |
| + |
| +bool UrlHandlingMessageFilter::OnMessageReceived( |
| + const IPC::Message& message, |
| + bool* message_was_ok) { |
| + bool handled = true; |
| + IPC_BEGIN_MESSAGE_MAP_EX(UrlHandlingMessageFilter, |
| + message, *message_was_ok) |
| + IPC_MESSAGE_HANDLER(RendererHostMsg_ForwardUrlToBrowser, |
| + OnForwardUrlToBrowser) |
| + IPC_MESSAGE_UNHANDLED(handled = false) |
|
not at google - send to devlin
2013/08/29 17:35:56
without looking into this: would it be possible fo
sergeygs
2013/08/30 00:39:44
Not really. All these IPCs are going through Rende
not at google - send to devlin
2013/08/30 17:07:58
I responded to this comment in platform_app_redire
sergeygs
2013/09/02 07:36:21
As already mentioned elsewhere, I've talked to jam
|
| + IPC_END_MESSAGE_MAP_EX() |
| + |
| + return handled; |
| +} |
| + |
| +UrlHandlingMessageFilter::~UrlHandlingMessageFilter() { |
| +} |
| + |
| +bool UrlHandlingMessageFilter::OnForwardUrlToBrowser( |
| + const GURL& url, |
| + const GURL& referrer_url) { |
| + ForwardUrlToBrowserDetails details(url, referrer_url); |
| + NotificationService::current()->Notify( |
| + content::NOTIFICATION_HANDLE_URL_IN_BROWSER, |
| + Source<RenderProcessHost>(render_process_host_), |
| + Details<ForwardUrlToBrowserDetails>(&details)); |
| + |
| + return true; |
| +} |
| + |
| +void UrlHandlingMessageFilter::OverrideThreadForMessage( |
| + const IPC::Message& message, BrowserThread::ID* thread) { |
| + switch (message.type()) { |
| + case RendererHostMsg_ForwardUrlToBrowser::ID: |
| + *thread = BrowserThread::UI; |
| + break; |
| + default: |
| + break; |
| + } |
| +} |
| + |
| +} // namespace content |