| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DNS_MDNS_CLIENT_IMPL_H_ | 5 #ifndef NET_DNS_MDNS_CLIENT_IMPL_H_ |
| 6 #define NET_DNS_MDNS_CLIENT_IMPL_H_ | 6 #define NET_DNS_MDNS_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 uint16 rrtype, | 167 uint16 rrtype, |
| 168 const std::string& name, | 168 const std::string& name, |
| 169 MDnsListener::Delegate* delegate) OVERRIDE; | 169 MDnsListener::Delegate* delegate) OVERRIDE; |
| 170 | 170 |
| 171 virtual scoped_ptr<MDnsTransaction> CreateTransaction( | 171 virtual scoped_ptr<MDnsTransaction> CreateTransaction( |
| 172 uint16 rrtype, | 172 uint16 rrtype, |
| 173 const std::string& name, | 173 const std::string& name, |
| 174 int flags, | 174 int flags, |
| 175 const MDnsTransaction::ResultCallback& callback) OVERRIDE; | 175 const MDnsTransaction::ResultCallback& callback) OVERRIDE; |
| 176 | 176 |
| 177 // Returns true when the client is listening for network packets. | 177 virtual bool StartListening() OVERRIDE; |
| 178 bool IsListeningForTests(); | 178 virtual void StopListening() OVERRIDE; |
| 179 | 179 virtual bool GetListening() const OVERRIDE; |
| 180 bool AddListenRef(); | |
| 181 void SubtractListenRef(); | |
| 182 | 180 |
| 183 Core* core() { return core_.get(); } | 181 Core* core() { return core_.get(); } |
| 184 | 182 |
| 185 private: | 183 private: |
| 186 // This method causes the client to stop listening for packets. The | |
| 187 // call for it is deferred through the message loop after the last | |
| 188 // listener is removed. If another listener is added after a | |
| 189 // shutdown is scheduled but before it actually runs, the shutdown | |
| 190 // will be canceled. | |
| 191 void Shutdown(); | |
| 192 | |
| 193 scoped_ptr<Core> core_; | 184 scoped_ptr<Core> core_; |
| 194 int listen_refs_; | |
| 195 | 185 |
| 196 scoped_ptr<MDnsConnection::SocketFactory> socket_factory_; | 186 scoped_ptr<MDnsConnection::SocketFactory> socket_factory_; |
| 197 | 187 |
| 198 DISALLOW_COPY_AND_ASSIGN(MDnsClientImpl); | 188 DISALLOW_COPY_AND_ASSIGN(MDnsClientImpl); |
| 199 }; | 189 }; |
| 200 | 190 |
| 201 class MDnsListenerImpl : public MDnsListener, | 191 class MDnsListenerImpl : public MDnsListener, |
| 202 public base::SupportsWeakPtr<MDnsListenerImpl> { | 192 public base::SupportsWeakPtr<MDnsListenerImpl> { |
| 203 public: | 193 public: |
| 204 MDnsListenerImpl(uint16 rrtype, | 194 MDnsListenerImpl(uint16 rrtype, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 MDnsClientImpl* client_; | 278 MDnsClientImpl* client_; |
| 289 | 279 |
| 290 bool started_; | 280 bool started_; |
| 291 int flags_; | 281 int flags_; |
| 292 | 282 |
| 293 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl); | 283 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl); |
| 294 }; | 284 }; |
| 295 | 285 |
| 296 } // namespace net | 286 } // namespace net |
| 297 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_ | 287 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_ |
| OLD | NEW |