diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-02 21:07:12 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-02 21:07:12 +0000 |
commit | 90ae1fb15d69378587f608f1bce437956b845a12 (patch) | |
tree | 7db5220f440e7b425cc67c2304b860494c1da72a /net/proxy/proxy_resolver_v8.h | |
parent | d5726c5273e71ae842c1d7136821210f2f691592 (diff) | |
download | chromium_src-90ae1fb15d69378587f608f1bce437956b845a12.zip chromium_src-90ae1fb15d69378587f608f1bce437956b845a12.tar.gz chromium_src-90ae1fb15d69378587f608f1bce437956b845a12.tar.bz2 |
Rename ProxyResolverV8::JSBindings --> ProxyResolverJSBindings.
(Since it isn't really V8-specific, and could be re-used for impelmentations
using a different JS engine).
Review URL: http://codereview.chromium.org/159773
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_resolver_v8.h')
-rw-r--r-- | net/proxy/proxy_resolver_v8.h | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h index 4c364e5..6689191 100644 --- a/net/proxy/proxy_resolver_v8.h +++ b/net/proxy/proxy_resolver_v8.h @@ -15,6 +15,7 @@ class MessageLoop; namespace net { class HostResolver; +class ProxyResolverJSBindings; // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts. // @@ -36,12 +37,10 @@ class HostResolver; // and does not use locking since it expects to be alone. class ProxyResolverV8 : public ProxyResolver { public: - class JSBindings; - // Constructs a ProxyResolverV8 with custom bindings. ProxyResolverV8 takes // ownership of |custom_js_bindings| and deletes it when ProxyResolverV8 // is destroyed. - explicit ProxyResolverV8(JSBindings* custom_js_bindings); + explicit ProxyResolverV8(ProxyResolverJSBindings* custom_js_bindings); virtual ~ProxyResolverV8(); @@ -52,22 +51,7 @@ class ProxyResolverV8 : public ProxyResolver { RequestHandle* /*request*/); virtual void CancelRequest(RequestHandle request); - JSBindings* js_bindings() const { return js_bindings_.get(); } - - // Creates a default javascript bindings implementation that will: - // - Send script error messages to LOG(INFO) - // - Send script alert()s to LOG(INFO) - // - Use the provided host resolver to service dnsResolve(). - // - // For clients that need more control (for example, sending the script output - // to a UI widget), use the ProxyResolverV8(JSBindings*) and specify your - // own bindings. - // - // |host_resolver| will be used in async mode on |host_resolver_loop|. If - // |host_resolver_loop| is NULL, then |host_resolver| will be used in sync - // mode on the PAC thread. - static JSBindings* CreateDefaultBindings(HostResolver* host_resolver, - MessageLoop* host_resolver_loop); + ProxyResolverJSBindings* js_bindings() const { return js_bindings_.get(); } private: // Context holds the Javascript state for the most recently loaded PAC @@ -80,30 +64,11 @@ class ProxyResolverV8 : public ProxyResolver { scoped_ptr<Context> context_; - scoped_ptr<JSBindings> js_bindings_; + scoped_ptr<ProxyResolverJSBindings> js_bindings_; DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); }; -// Interface for the javascript bindings. -class ProxyResolverV8::JSBindings { - public: - virtual ~JSBindings() {} - - // Handler for "alert(message)" - virtual void Alert(const std::string& message) = 0; - - // Handler for "myIpAddress()". Returns empty string on failure. - virtual std::string MyIpAddress() = 0; - - // Handler for "dnsResolve(host)". Returns empty string on failure. - virtual std::string DnsResolve(const std::string& host) = 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 std::string& error) = 0; -}; - } // namespace net #endif // NET_PROXY_PROXY_RESOLVER_V8_H_ |