Chromium Code Reviews| Index: net/proxy/proxy_resolver_v8.h |
| diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h |
| index c00bb8a4b2465e57ef49f8baa375a87dc61935c8..e873450e2b93c7a95b037b51addbed4f1a228924 100644 |
| --- a/net/proxy/proxy_resolver_v8.h |
| +++ b/net/proxy/proxy_resolver_v8.h |
| @@ -12,8 +12,6 @@ |
| namespace net { |
| -class ProxyResolverJSBindings; |
| - |
| // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts. |
| // |
| // ---------------------------------------------------------------------------- |
| @@ -34,14 +32,43 @@ class ProxyResolverJSBindings; |
| // and does not use locking since it expects to be alone. |
| class NET_EXPORT_PRIVATE ProxyResolverV8 : public ProxyResolver { |
| public: |
| - // Constructs a ProxyResolverV8 with custom bindings. ProxyResolverV8 takes |
| - // ownership of |custom_js_bindings| and deletes it when ProxyResolverV8 |
| - // is destroyed. |
| - explicit ProxyResolverV8(ProxyResolverJSBindings* custom_js_bindings); |
| + // Interface for the javascript bindings. |
| + class NET_EXPORT_PRIVATE JSBindings { |
| + public: |
| + enum ResolveDnsOperation { |
| + DNS_RESOLVE, |
| + DNS_RESOLVE_EX, |
| + MY_IP_ADDRESS, |
| + MY_IP_ADDRESS_EX, |
| + NUM_DNS_OPERATIONS, |
| + }; |
| + |
| + JSBindings() {} |
| + |
| + virtual ~JSBindings() {} |
| + |
| + // Handler for "alert(message)" |
| + virtual void Alert(const string16& message) = 0; |
| + |
| + // Handler for "dnsResolve()", "dnsResolveEx()", "myIpAddress()", |
| + // "myIpAddressEx()". Returns true on success and fills |*output| with the |
| + // result. |
| + virtual bool ResolveDns(const std::string& host, |
| + ResolveDnsOperation op, |
| + std::string* output) = 0; |
| + |
| + // Handler for when an error is encountered. |line_number| may be -1 |
| + // if a line number is not applicable to this error. |
| + virtual void OnError(int line_number, const string16& error) = 0; |
| + }; |
| + |
| + // Constructs a ProxyResolverV8. |
| + ProxyResolverV8(); |
| virtual ~ProxyResolverV8(); |
| - ProxyResolverJSBindings* js_bindings() const { return js_bindings_.get(); } |
| + JSBindings* js_bindings() const { return js_bindings_; } |
| + void set_js_bindings(JSBindings* js_bindings) { js_bindings_ = js_bindings; } |
| // ProxyResolver implementation: |
| virtual int GetProxyForURL(const GURL& url, |
| @@ -51,11 +78,8 @@ class NET_EXPORT_PRIVATE ProxyResolverV8 : public ProxyResolver { |
| const BoundNetLog& net_log) OVERRIDE; |
| virtual void CancelRequest(RequestHandle request) OVERRIDE; |
| virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; |
| - virtual LoadState GetLoadStateThreadSafe( |
| - RequestHandle request) const OVERRIDE; |
| virtual void CancelSetPacScript() OVERRIDE; |
| virtual void PurgeMemory() OVERRIDE; |
| - virtual void Shutdown() OVERRIDE; |
| virtual int SetPacScript( |
| const scoped_refptr<ProxyResolverScriptData>& script_data, |
| const net::CompletionCallback& /*callback*/) OVERRIDE; |
| @@ -65,9 +89,11 @@ class NET_EXPORT_PRIVATE ProxyResolverV8 : public ProxyResolver { |
| // script. It corresponds with the data from the last call to |
| // SetPacScript(). |
| class Context; |
| + friend class Context; |
|
mmenke
2013/01/18 19:59:40
I believe inner classes don't have to be friends t
eroman
2013/01/23 03:26:02
Done.
|
| + |
| scoped_ptr<Context> context_; |
| - scoped_ptr<ProxyResolverJSBindings> js_bindings_; |
| + JSBindings* js_bindings_; |
| DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); |
| }; |