| 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..41646e4e1699f4cf4010f74f7dfdf77dee029e4d
|
| --- /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/browser_thread.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"
|
| +
|
| +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)
|
| + 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
|
|
|