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

Unified Diff: chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc

Issue 11617005: Refactor PepperFlashFileHost and PepperBrokerHost to use MessageFilterHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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/browser/renderer_host/pepper/pepper_broker_message_filter.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc
diff --git a/chrome/browser/renderer_host/pepper/pepper_broker_host.cc b/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc
similarity index 53%
rename from chrome/browser/renderer_host/pepper/pepper_broker_host.cc
rename to chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc
index 02bb08af3da1267c2819672e6a86fac26570f813..f5d7dd8ffa97c6315dd1ed56e187a053fe5641c7 100644
--- a/chrome/browser/renderer_host/pepper/pepper_broker_host.cc
+++ b/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/renderer_host/pepper/pepper_broker_host.h"
+#include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h"
#include <string>
@@ -16,7 +16,6 @@
#include "ipc/ipc_message_macros.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/dispatch_host_message.h"
-#include "ppapi/host/resource_message_filter.h"
#include "ppapi/proxy/ppapi_messages.h"
using content::BrowserPpapiHost;
@@ -25,59 +24,34 @@ using content::RenderProcessHost;
namespace chrome {
-namespace {
-
-// This filter handles messages for the PepperBrokerHost on the UI thread.
-class BrokerMessageFilter : public ppapi::host::ResourceMessageFilter {
- public:
- BrokerMessageFilter(int render_process_id, GURL document_url);
-
- protected:
- // ppapi::host::ResourceMessageFilter override.
- virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
- const IPC::Message& message) OVERRIDE;
-
- // ppapi::host::ResourceMessageHandler override.
- virtual int32_t OnResourceMessageReceived(
- const IPC::Message& msg,
- ppapi::host::HostMessageContext* context) OVERRIDE;
-
- private:
- virtual ~BrokerMessageFilter();
-
- int32_t OnIsAllowed(ppapi::host::HostMessageContext* context);
-
- int render_process_id_;
- GURL document_url_;
-};
-
-BrokerMessageFilter::BrokerMessageFilter(
- int render_process_id,
- GURL document_url)
- : render_process_id_(render_process_id),
- document_url_(document_url) {
+PepperBrokerMessageFilter::PepperBrokerMessageFilter(
+ PP_Instance instance,
+ BrowserPpapiHost* host)
+ : document_url_(host->GetDocumentURLForInstance(instance)) {
+ int unused;
+ host->GetRenderViewIDsForInstance(instance, &render_process_id_, &unused);
}
-BrokerMessageFilter::~BrokerMessageFilter() {
+PepperBrokerMessageFilter::~PepperBrokerMessageFilter() {
}
scoped_refptr<base::TaskRunner>
-BrokerMessageFilter::OverrideTaskRunnerForMessage(
+PepperBrokerMessageFilter::OverrideTaskRunnerForMessage(
const IPC::Message& message) {
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
}
-int32_t BrokerMessageFilter::OnResourceMessageReceived(
+int32_t PepperBrokerMessageFilter::OnResourceMessageReceived(
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) {
- IPC_BEGIN_MESSAGE_MAP(BrokerMessageFilter, msg)
+ IPC_BEGIN_MESSAGE_MAP(PepperBrokerMessageFilter, msg)
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Broker_IsAllowed,
OnIsAllowed)
IPC_END_MESSAGE_MAP()
return PP_ERROR_FAILED;
}
-int32_t BrokerMessageFilter::OnIsAllowed(
+int32_t PepperBrokerMessageFilter::OnIsAllowed(
ppapi::host::HostMessageContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!document_url_.is_valid())
@@ -99,20 +73,4 @@ int32_t BrokerMessageFilter::OnIsAllowed(
return PP_ERROR_FAILED;
}
-} // namespace
-
-PepperBrokerHost::PepperBrokerHost(BrowserPpapiHost* host,
- PP_Instance instance,
- PP_Resource resource)
- : ResourceHost(host->GetPpapiHost(), instance, resource) {
- int render_process_id, unused;
- host->GetRenderViewIDsForInstance(instance, &render_process_id, &unused);
- const GURL& document_url = host->GetDocumentURLForInstance(instance);
- AddFilter(make_scoped_refptr(new BrokerMessageFilter(render_process_id,
- document_url)));
-}
-
-PepperBrokerHost::~PepperBrokerHost() {
-}
-
} // namespace chrome
« no previous file with comments | « chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698