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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/common/content_export.h" |
12 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class MessageLoopProxy; | 16 class MessageLoopProxy; |
16 } // namespace base | 17 } // namespace base |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class P2PSocketDispatcher; | 21 class P2PSocketDispatcher; |
21 | 22 |
22 // P2PHostAddressRequest performs DNS hostname resolution. It's used | 23 // P2PHostAddressRequest performs DNS hostname resolution. It's used |
23 // to resolve addresses of STUN and relay servers. | 24 // to resolve addresses of STUN and relay servers. |
24 // | 25 // |
25 // 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 |
26 // something else, e.g. P2PHostnameResolver. | 27 // something else, e.g. P2PHostnameResolver. |
27 class P2PHostAddressRequest : | 28 class CONTENT_EXPORT P2PHostAddressRequest |
28 public base::RefCountedThreadSafe<P2PHostAddressRequest> { | 29 : public base::RefCountedThreadSafe<P2PHostAddressRequest> { |
29 public: | 30 public: |
30 typedef base::Callback<void(const net::IPAddressNumber&)> DoneCallback; | 31 typedef base::Callback<void(const net::IPAddressNumber&)> DoneCallback; |
31 | 32 |
32 P2PHostAddressRequest(P2PSocketDispatcher* dispatcher); | 33 P2PHostAddressRequest(P2PSocketDispatcher* dispatcher); |
33 | 34 |
34 // Sends host address request. | 35 // Sends host address request. |
35 void Request(const std::string& host_name, | 36 void Request(const std::string& host_name, |
36 const DoneCallback& done_callback); | 37 const DoneCallback& done_callback); |
37 | 38 |
38 // Cancels the request. The callback passed to Request() will not be | 39 // Cancels the request. The callback passed to Request() will not be |
(...skipping 29 matching lines...) Expand all Loading... |
68 // Accessed on the IPC thread only. | 69 // Accessed on the IPC thread only. |
69 int32 request_id_; | 70 int32 request_id_; |
70 bool registered_; | 71 bool registered_; |
71 | 72 |
72 DISALLOW_COPY_AND_ASSIGN(P2PHostAddressRequest); | 73 DISALLOW_COPY_AND_ASSIGN(P2PHostAddressRequest); |
73 }; | 74 }; |
74 | 75 |
75 } // namespace content | 76 } // namespace content |
76 | 77 |
77 #endif // CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ | 78 #endif // CONTENT_RENDERER_P2P_HOST_ADDRESS_REQUEST_H_ |
OLD | NEW |