OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_V8_H_ | 5 #ifndef NET_PROXY_PROXY_RESOLVER_V8_H_ |
6 #define NET_PROXY_PROXY_RESOLVER_V8_H_ | 6 #define NET_PROXY_PROXY_RESOLVER_V8_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 enum ResolveDnsOperation { | 38 enum ResolveDnsOperation { |
39 DNS_RESOLVE, | 39 DNS_RESOLVE, |
40 DNS_RESOLVE_EX, | 40 DNS_RESOLVE_EX, |
41 MY_IP_ADDRESS, | 41 MY_IP_ADDRESS, |
42 MY_IP_ADDRESS_EX, | 42 MY_IP_ADDRESS_EX, |
43 NUM_DNS_OPERATIONS, | 43 NUM_DNS_OPERATIONS, |
44 }; | 44 }; |
45 | 45 |
46 JSBindings() {} | 46 JSBindings() {} |
47 | 47 |
48 virtual ~JSBindings() {} | |
49 | |
50 // Handler for "dnsResolve()", "dnsResolveEx()", "myIpAddress()", | 48 // Handler for "dnsResolve()", "dnsResolveEx()", "myIpAddress()", |
51 // "myIpAddressEx()". Returns true on success and fills |*output| with the | 49 // "myIpAddressEx()". Returns true on success and fills |*output| with the |
52 // result. | 50 // result. |
53 virtual bool ResolveDns(const std::string& host, | 51 virtual bool ResolveDns(const std::string& host, |
54 ResolveDnsOperation op, | 52 ResolveDnsOperation op, |
55 std::string* output) = 0; | 53 std::string* output) = 0; |
56 | 54 |
57 // Handler for "alert(message)" | 55 // Handler for "alert(message)" |
58 virtual void Alert(const string16& message) = 0; | 56 virtual void Alert(const string16& message) = 0; |
59 | 57 |
60 // Handler for when an error is encountered. |line_number| may be -1 | 58 // Handler for when an error is encountered. |line_number| may be -1 |
61 // if a line number is not applicable to this error. | 59 // if a line number is not applicable to this error. |
62 virtual void OnError(int line_number, const string16& error) = 0; | 60 virtual void OnError(int line_number, const string16& error) = 0; |
| 61 |
| 62 protected: |
| 63 virtual ~JSBindings() {} |
63 }; | 64 }; |
64 | 65 |
65 // Constructs a ProxyResolverV8. | 66 // Constructs a ProxyResolverV8. |
66 ProxyResolverV8(); | 67 ProxyResolverV8(); |
67 | 68 |
68 virtual ~ProxyResolverV8(); | 69 virtual ~ProxyResolverV8(); |
69 | 70 |
70 JSBindings* js_bindings() const { return js_bindings_; } | 71 JSBindings* js_bindings() const { return js_bindings_; } |
71 void set_js_bindings(JSBindings* js_bindings) { js_bindings_ = js_bindings; } | 72 void set_js_bindings(JSBindings* js_bindings) { js_bindings_ = js_bindings; } |
72 | 73 |
(...skipping 20 matching lines...) Expand all Loading... |
93 scoped_ptr<Context> context_; | 94 scoped_ptr<Context> context_; |
94 | 95 |
95 JSBindings* js_bindings_; | 96 JSBindings* js_bindings_; |
96 | 97 |
97 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); | 98 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); |
98 }; | 99 }; |
99 | 100 |
100 } // namespace net | 101 } // namespace net |
101 | 102 |
102 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_ | 103 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_ |
OLD | NEW |