Index: content/renderer/pepper/pepper_flash_renderer_host.cc |
diff --git a/content/renderer/pepper/pepper_flash_renderer_host.cc b/content/renderer/pepper/pepper_flash_renderer_host.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e651a61c1e10c44091a2ced9c8b26075251ca589 |
--- /dev/null |
+++ b/content/renderer/pepper/pepper_flash_renderer_host.cc |
@@ -0,0 +1,55 @@ |
+// Copyright (c) 2012 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/renderer/pepper/pepper_flash_renderer_host.h" |
+ |
+#include "content/common/view_messages.h" |
+#include "content/public/renderer/renderer_ppapi_host.h" |
+#include "content/renderer/render_thread_impl.h" |
+#include "googleurl/src/gurl.h" |
+#include "ipc/ipc_message_macros.h" |
+#include "ppapi/c/pp_errors.h" |
+#include "ppapi/host/dispatch_host_message.h" |
+#include "ppapi/proxy/ppapi_messages.h" |
+#include "ppapi/proxy/resource_message_params.h" |
+ |
+namespace content { |
+ |
+PepperFlashRendererHost::PepperFlashRendererHost( |
+ RendererPpapiHost* host, |
+ PP_Instance instance, |
+ PP_Resource resource) |
+ : ResourceHost(host->GetPpapiHost(), instance, resource) { |
+} |
+ |
+PepperFlashRendererHost::~PepperFlashRendererHost() { |
+} |
+ |
+int32_t PepperFlashRendererHost::OnResourceMessageReceived( |
+ const IPC::Message& msg, |
+ ppapi::host::HostMessageContext* context) { |
+ IPC_BEGIN_MESSAGE_MAP(PepperFlashRendererHost, msg) |
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetProxyForURL, |
+ OnMsgGetProxyForURL); |
+ IPC_END_MESSAGE_MAP() |
+ return PP_ERROR_FAILED; |
+} |
+ |
+int32_t PepperFlashRendererHost::OnMsgGetProxyForURL( |
+ ppapi::host::HostMessageContext* host_context, |
+ const std::string& url) { |
+ bool result; |
brettw
2012/11/30 23:29:25
Random nit: I'd put these two out params right abo
raymes
2012/12/03 17:30:31
Done.
|
+ std::string proxy; |
+ GURL gurl(url); |
+ if (!gurl.is_valid()) |
+ return PP_ERROR_FAILED; |
+ RenderThreadImpl::current()->Send( |
+ new ViewHostMsg_ResolveProxy(gurl, &result, &proxy)); |
+ if (!result) |
+ return PP_ERROR_FAILED; |
+ host_context->reply_msg = PpapiPluginMsg_Flash_GetProxyForURLReply(proxy); |
+ return PP_OK; |
+} |
+ |
+} // namespace content |