1 // Copyright 2014 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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_ADDRESS_RESOLVER_H_ 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_ADDRESS_RESOLVER_H_ 7 8 #include "ppapi/cpp/host_resolver.h" 9 #include "ppapi/utility/completion_callback_factory.h" 10 #include "third_party/webrtc/base/asyncresolverinterface.h" 11 12 namespace remoting { 13 14 // rtc::AsyncResolverInterface implementation that uses Pepper to resolve 15 // addresses. 16 class PepperAddressResolver : public rtc::AsyncResolverInterface { 17 public: 18 explicit PepperAddressResolver(const pp::InstanceHandle& instance); 19 virtual ~PepperAddressResolver(); 20 21 // rtc::AsyncResolverInterface. 22 virtual void Start(const rtc::SocketAddress& addr) OVERRIDE; 23 virtual bool GetResolvedAddress(int family, 24 rtc::SocketAddress* addr) const OVERRIDE; 25 virtual int GetError() const OVERRIDE; 26 virtual void Destroy(bool wait) OVERRIDE; 27 28 private: 29 void OnResolved(int32_t result); 30 31 pp::HostResolver resolver_; 32 33 rtc::SocketAddress ipv4_address_; 34 rtc::SocketAddress ipv6_address_; 35 36 int error_; 37 38 pp::CompletionCallbackFactory<PepperAddressResolver> callback_factory_; 39 40 DISALLOW_COPY_AND_ASSIGN(PepperAddressResolver); 41 }; 42 43 } // namespace remoting 44 45 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_ADDRESS_RESOLVER_H_ 46