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