Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/pepper/pepper_flash_renderer_host.h" | |
| 6 | |
| 7 #include "content/common/view_messages.h" | |
| 8 #include "content/public/renderer/renderer_ppapi_host.h" | |
| 9 #include "content/renderer/render_thread_impl.h" | |
| 10 #include "googleurl/src/gurl.h" | |
| 11 #include "ipc/ipc_message_macros.h" | |
| 12 #include "ppapi/c/pp_errors.h" | |
| 13 #include "ppapi/host/dispatch_host_message.h" | |
| 14 #include "ppapi/proxy/ppapi_messages.h" | |
| 15 #include "ppapi/proxy/resource_message_params.h" | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 PepperFlashRendererHost::PepperFlashRendererHost( | |
| 20 RendererPpapiHost* host, | |
| 21 PP_Instance instance, | |
| 22 PP_Resource resource) | |
| 23 : ResourceHost(host->GetPpapiHost(), instance, resource) { | |
| 24 } | |
| 25 | |
| 26 PepperFlashRendererHost::~PepperFlashRendererHost() { | |
| 27 } | |
| 28 | |
| 29 int32_t PepperFlashRendererHost::OnResourceMessageReceived( | |
| 30 const IPC::Message& msg, | |
| 31 ppapi::host::HostMessageContext* context) { | |
| 32 IPC_BEGIN_MESSAGE_MAP(PepperFlashRendererHost, msg) | |
| 33 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetProxyForURL, | |
| 34 OnMsgGetProxyForURL); | |
| 35 IPC_END_MESSAGE_MAP() | |
| 36 return PP_ERROR_FAILED; | |
| 37 } | |
| 38 | |
| 39 int32_t PepperFlashRendererHost::OnMsgGetProxyForURL( | |
| 40 ppapi::host::HostMessageContext* host_context, | |
| 41 const std::string& url) { | |
| 42 bool result; | |
| 43 std::string proxy; | |
| 44 GURL gurl(url); | |
| 45 if (!gurl.is_valid()) | |
| 46 return PP_ERROR_FAILED; | |
| 47 RenderThreadImpl::current()->Send( | |
| 48 new ViewHostMsg_ResolveProxy(gurl, &result, &proxy)); | |
| 49 if (!result) | |
| 50 return PP_ERROR_FAILED; | |
| 51 host_context->reply_msg = PpapiPluginMsg_Flash_GetProxyForURLReply(proxy); | |
|
victorhsieh
2012/11/28 07:09:50
you don't need to host()->SendReply?
raymes
2012/11/29 00:08:08
Nope. If you handle the message synchronously then
victorhsieh
2012/11/29 06:17:23
Hmm.. we could have a "WillSyncReply" or something
| |
| 52 return PP_OK; | |
| 53 } | |
| 54 | |
| 55 } // namespace content | |
| OLD | NEW |