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