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 CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ | 5 #ifndef CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ |
6 #define CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ | 6 #define CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // P2PHostAddressRequest performs DNS hostname resolution. It's used | 23 // P2PHostAddressRequest performs DNS hostname resolution. It's used |
24 // to resolve addresses of STUN and relay servers. | 24 // to resolve addresses of STUN and relay servers. |
25 // | 25 // |
26 // TODO(sergeyu): Name of this class may be confusing. Rename it to | 26 // TODO(sergeyu): Name of this class may be confusing. Rename it to |
27 // something else, e.g. P2PHostnameResolver. | 27 // something else, e.g. P2PHostnameResolver. |
28 class CONTENT_EXPORT P2PHostAddressRequest | 28 class CONTENT_EXPORT P2PHostAddressRequest |
29 : public base::RefCountedThreadSafe<P2PHostAddressRequest> { | 29 : public base::RefCountedThreadSafe<P2PHostAddressRequest> { |
30 public: | 30 public: |
31 typedef base::Callback<void(const net::IPAddressNumber&)> DoneCallback; | 31 typedef base::Callback<void(const net::IPAddressNumber&)> DoneCallback; |
32 | 32 |
33 P2PHostAddressRequest(P2PSocketDispatcher* dispatcher); | 33 explicit P2PHostAddressRequest(P2PSocketDispatcher* dispatcher); |
34 | 34 |
35 // Sends host address request. | 35 // Sends host address request. |
36 void Request(const std::string& host_name, | 36 void Request(const std::string& host_name, |
37 const DoneCallback& done_callback); | 37 const DoneCallback& done_callback); |
38 | 38 |
39 // Cancels the request. The callback passed to Request() will not be | 39 // Cancels the request. The callback passed to Request() will not be |
40 // called after Cancel() is called. | 40 // called after Cancel() is called. |
41 void Cancel(); | 41 void Cancel(); |
42 | 42 |
43 private: | 43 private: |
(...skipping 25 matching lines...) Expand all Loading... |
69 // Accessed on the IPC thread only. | 69 // Accessed on the IPC thread only. |
70 int32 request_id_; | 70 int32 request_id_; |
71 bool registered_; | 71 bool registered_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(P2PHostAddressRequest); | 73 DISALLOW_COPY_AND_ASSIGN(P2PHostAddressRequest); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace content | 76 } // namespace content |
77 | 77 |
78 #endif // CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ | 78 #endif // CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ |
OLD | NEW |