1 // Copyright (c) 2010 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 NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ 6 #define NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ 7 #pragma once 8 9 #include <string> 10 11 namespace net { 12 13 // Interface for the javascript bindings. 14 class ProxyResolverJSBindings { 15 public: ProxyResolverJSBindings()16 ProxyResolverJSBindings() {}// : current_request_context_(NULL) {} 17 ~ProxyResolverJSBindings()18 virtual ~ProxyResolverJSBindings() {} 19 20 // Handler for "myIpAddress()". Returns true on success and fills 21 // |*first_ip_address| with the result. 22 virtual bool MyIpAddress(std::string* first_ip_address) = 0; 23 24 // Handler for "myIpAddressEx()". Returns true on success and fills 25 // |*ip_address_list| with the result. 26 // 27 // This is a Microsoft extension to PAC for IPv6, see: 28 // http://blogs.msdn.com/b/wndp/archive/2006/07/13/ipv6-pac-extensions-v0-9.aspx 29 30 virtual bool MyIpAddressEx(std::string* ip_address_list) = 0; 31 32 // Handler for "dnsResolve(host)". Returns true on success and fills 33 // |*first_ip_address| with the result. 34 virtual bool DnsResolve(const std::string& host, 35 std::string* first_ip_address) = 0; 36 37 // Handler for "dnsResolveEx(host)". Returns true on success and fills 38 // |*ip_address_list| with the result. 39 // 40 // This is a Microsoft extension to PAC for IPv6, see: 41 // http://blogs.msdn.com/b/wndp/archive/2006/07/13/ipv6-pac-extensions-v0-9.aspx 42 virtual bool DnsResolveEx(const std::string& host, 43 std::string* ip_address_list) = 0; 44 45 // Creates a default javascript bindings implementation that will: 46 // - Use the provided host resolver to service dnsResolve(). 47 // 48 // Note that |host_resolver| will be used in sync mode mode. 49 static ProxyResolverJSBindings* CreateDefault(); 50 51 private: 52 }; 53 54 } // namespace net 55 56 #endif // NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ 57