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 #include "chrome/utility/local_discovery/service_discovery_message_handler.h" | 5 #include "chrome/utility/local_discovery/service_discovery_message_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "chrome/common/local_discovery/local_discovery_messages.h" | 10 #include "chrome/common/local_discovery/local_discovery_messages.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 void ServiceDiscoveryMessageHandler::InitializeMdns() { | 157 void ServiceDiscoveryMessageHandler::InitializeMdns() { |
158 if (service_discovery_client_ || mdns_client_) | 158 if (service_discovery_client_ || mdns_client_) |
159 return; | 159 return; |
160 | 160 |
161 mdns_client_ = net::MDnsClient::CreateDefault(); | 161 mdns_client_ = net::MDnsClient::CreateDefault(); |
162 { | 162 { |
163 // Temporarily redirect network code to use pre-created sockets. | 163 // Temporarily redirect network code to use pre-created sockets. |
164 ScopedSocketFactorySetter socket_factory_setter; | 164 ScopedSocketFactorySetter socket_factory_setter; |
165 if (!mdns_client_->StartListening()) { | 165 scoped_ptr<net::MDnsSocketFactory> mdns_sockets = |
| 166 net::MDnsSocketFactory::CreateDefault(); |
| 167 if (!mdns_client_->StartListening(mdns_sockets.get())) { |
166 VLOG(1) << "Failed to start MDnsClient"; | 168 VLOG(1) << "Failed to start MDnsClient"; |
167 Send(new LocalDiscoveryHostMsg_Error()); | 169 Send(new LocalDiscoveryHostMsg_Error()); |
168 return; | 170 return; |
169 } | 171 } |
170 } | 172 } |
171 | 173 |
172 service_discovery_client_.reset( | 174 service_discovery_client_.reset( |
173 new local_discovery::ServiceDiscoveryClientImpl(mdns_client_.get())); | 175 new local_discovery::ServiceDiscoveryClientImpl(mdns_client_.get())); |
174 } | 176 } |
175 | 177 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 id, success, address_ipv4, address_ipv6)); | 422 id, success, address_ipv4, address_ipv6)); |
421 } | 423 } |
422 | 424 |
423 void ServiceDiscoveryMessageHandler::Send(IPC::Message* msg) { | 425 void ServiceDiscoveryMessageHandler::Send(IPC::Message* msg) { |
424 utility_task_runner_->PostTask(FROM_HERE, | 426 utility_task_runner_->PostTask(FROM_HERE, |
425 base::Bind(&SendHostMessageOnUtilityThread, | 427 base::Bind(&SendHostMessageOnUtilityThread, |
426 msg)); | 428 msg)); |
427 } | 429 } |
428 | 430 |
429 } // namespace local_discovery | 431 } // namespace local_discovery |
OLD | NEW |