| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ | 5 #ifndef NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ |
| 6 #define NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ | 6 #define NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 | 11 |
| 12 class MessageLoop; | 12 class MessageLoop; |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 class HostResolver; | 16 class HostResolver; |
| 17 class NetLog; |
| 17 struct ProxyResolverRequestContext; | 18 struct ProxyResolverRequestContext; |
| 18 | 19 |
| 19 // Interface for the javascript bindings. | 20 // Interface for the javascript bindings. |
| 20 class ProxyResolverJSBindings { | 21 class ProxyResolverJSBindings { |
| 21 public: | 22 public: |
| 22 ProxyResolverJSBindings() : current_request_context_(NULL) {} | 23 ProxyResolverJSBindings() : current_request_context_(NULL) {} |
| 23 | 24 |
| 24 virtual ~ProxyResolverJSBindings() {} | 25 virtual ~ProxyResolverJSBindings() {} |
| 25 | 26 |
| 26 // Handler for "alert(message)" | 27 // Handler for "alert(message)" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 51 std::string* ip_address_list) = 0; | 52 std::string* ip_address_list) = 0; |
| 52 | 53 |
| 53 // Handler for when an error is encountered. |line_number| may be -1 | 54 // Handler for when an error is encountered. |line_number| may be -1 |
| 54 // if a line number is not applicable to this error. | 55 // if a line number is not applicable to this error. |
| 55 virtual void OnError(int line_number, const string16& error) = 0; | 56 virtual void OnError(int line_number, const string16& error) = 0; |
| 56 | 57 |
| 57 // Called before the thread running the proxy resolver is stopped. | 58 // Called before the thread running the proxy resolver is stopped. |
| 58 virtual void Shutdown() = 0; | 59 virtual void Shutdown() = 0; |
| 59 | 60 |
| 60 // Creates a default javascript bindings implementation that will: | 61 // Creates a default javascript bindings implementation that will: |
| 61 // - Send script error messages to LOG(INFO) | 62 // - Send script error messages to both LOG(INFO), and the NetLog. |
| 62 // - Send script alert()s to LOG(INFO) | 63 // - Send script alert()s to both LOG(INFO), and the NetLog. |
| 63 // - Use the provided host resolver to service dnsResolve(). | 64 // - Use the provided host resolver to service dnsResolve(). |
| 64 // | 65 // |
| 65 // Note that |host_resolver| will be used in sync mode mode. | 66 // Note that |host_resolver| will be used in sync mode mode. |
| 66 static ProxyResolverJSBindings* CreateDefault(HostResolver* host_resolver); | 67 static ProxyResolverJSBindings* CreateDefault(HostResolver* host_resolver, |
| 68 NetLog* net_log); |
| 67 | 69 |
| 68 // Sets details about the currently executing FindProxyForURL() request. | 70 // Sets details about the currently executing FindProxyForURL() request. |
| 69 void set_current_request_context( | 71 void set_current_request_context( |
| 70 ProxyResolverRequestContext* current_request_context) { | 72 ProxyResolverRequestContext* current_request_context) { |
| 71 current_request_context_ = current_request_context; | 73 current_request_context_ = current_request_context; |
| 72 } | 74 } |
| 73 | 75 |
| 74 // Retrieves details about the currently executing FindProxyForURL() request. | 76 // Retrieves details about the currently executing FindProxyForURL() request. |
| 75 ProxyResolverRequestContext* current_request_context() { | 77 ProxyResolverRequestContext* current_request_context() { |
| 76 return current_request_context_; | 78 return current_request_context_; |
| 77 } | 79 } |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 ProxyResolverRequestContext* current_request_context_; | 82 ProxyResolverRequestContext* current_request_context_; |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 } // namespace net | 85 } // namespace net |
| 84 | 86 |
| 85 #endif // NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ | 87 #endif // NET_PROXY_PROXY_RESOLVER_JS_BINDINGS_H_ |
| OLD | NEW |