Chromium Code Reviews| Index: content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| index 187aae4474999664e3e5fa639c53ca3c35710500..bf70d3c62fa19dbcf250579c7725750e3ff2da18 100644 |
| --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| @@ -5,6 +5,7 @@ |
| #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| #include <cmath> |
| +#include <cstddef> |
| #include <map> |
| #include <queue> |
| @@ -56,11 +57,13 @@ |
| #include "ppapi/c/pp_errors.h" |
| #include "ppapi/c/private/ppb_flash.h" |
| #include "ppapi/c/private/ppb_flash_net_connector.h" |
| +// #include "ppapi/c/private/ppb_host_resolver_private.h" |
|
yzshen1
2012/02/28 08:29:00
Remove it instead of commenting it out.
ygorshenin1
2012/02/28 12:09:47
Done.
|
| #include "ppapi/proxy/host_dispatcher.h" |
| #include "ppapi/proxy/ppapi_messages.h" |
| -#include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| #include "ppapi/shared_impl/platform_file.h" |
| #include "ppapi/shared_impl/ppapi_preferences.h" |
| +#include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| +#include "ppapi/shared_impl/private/network_list.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserCompletion.h" |
| @@ -1330,6 +1333,45 @@ void PepperPluginDelegateImpl::TCPServerSocketStopListening( |
| } |
| } |
| +void PepperPluginDelegateImpl::RegisterHostResolver( |
| + ppapi::PPB_HostResolver_Shared* host_resolver, |
| + uint32 host_resolver_id) { |
| + host_resolvers_.AddWithID(host_resolver, host_resolver_id); |
| +} |
| + |
| +void PepperPluginDelegateImpl::HostResolverResolve( |
| + uint32 host_resolver_id, |
| + const std::string& host, |
| + uint16_t port, |
| + const PP_HostResolver_Private_Hint* hint) { |
| + DCHECK(host_resolvers_.Lookup(host_resolver_id)); |
| + if (hint == NULL) { |
|
yzshen1
2012/02/28 08:29:00
nit: if (!hint) is more common.
ygorshenin1
2012/02/28 12:09:47
Done.
|
| + PP_HostResolver_Private_Hint empty_hint; |
| + empty_hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED; |
| + empty_hint.flags = static_cast<PP_HostResolver_Private_Flags>(0); |
| + render_view_->Send( |
| + new PpapiHostMsg_PPBHostResolver_Resolve( |
| + GetRoutingId(), |
| + host_resolver_id, |
| + host, |
| + port, |
| + empty_hint)); |
| + } else { |
| + render_view_->Send( |
| + new PpapiHostMsg_PPBHostResolver_Resolve( |
| + GetRoutingId(), |
| + host_resolver_id, |
| + host, |
| + port, |
| + *hint)); |
| + } |
| +} |
| + |
| +void PepperPluginDelegateImpl::UnregisterHostResolver( |
| + uint32 host_resolver_id) { |
| + host_resolvers_.Remove(host_resolver_id); |
| +} |
| + |
| int32_t PepperPluginDelegateImpl::ShowContextMenu( |
| webkit::ppapi::PluginInstance* instance, |
| webkit::ppapi::PPB_Flash_Menu_Impl* menu, |
| @@ -1571,6 +1613,8 @@ int PepperPluginDelegateImpl::EnumerateDevices( |
| bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) |
| + IPC_MESSAGE_HANDLER(PpapiMsg_PPBHostResolver_ResolveACK, |
|
yzshen1
2012/02/28 08:29:00
You might want to keep the list in the same order
ygorshenin1
2012/02/28 12:09:47
Done.
|
| + OnHostResolverResolveACK) |
| IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, |
| OnTCPSocketConnectACK) |
| IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| @@ -1712,6 +1756,16 @@ void PepperPluginDelegateImpl::OnTCPServerSocketAcceptACK( |
| } |
| } |
| +void PepperPluginDelegateImpl::OnHostResolverResolveACK( |
| + uint32 host_resolver_id, |
| + bool succeeded, |
| + const ppapi::NetworkList& network_list) { |
| + ppapi::PPB_HostResolver_Shared* host_resolver = |
| + host_resolvers_.Lookup(host_resolver_id); |
| + if (host_resolver) |
| + host_resolver->OnResolveCompleted(succeeded, network_list); |
| +} |
| + |
| int PepperPluginDelegateImpl::GetRoutingId() const { |
| return render_view_->routing_id(); |
| } |