| 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 <vector> | 5 #include <vector> | 
| 6 | 6 | 
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" | 
| 8 #include "base/bind.h" | 8 #include "base/bind.h" | 
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" | 
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 50   } | 50   } | 
| 51 | 51 | 
| 52   printf("\tAddress: %s:%d\n", service.address.host().c_str(), | 52   printf("\tAddress: %s:%d\n", service.address.host().c_str(), | 
| 53          service.address.port()); | 53          service.address.port()); | 
| 54   printf("\tMetadata: \n"); | 54   printf("\tMetadata: \n"); | 
| 55   for (std::vector<std::string>::const_iterator i = service.metadata.begin(); | 55   for (std::vector<std::string>::const_iterator i = service.metadata.begin(); | 
| 56        i != service.metadata.end(); i++) { | 56        i != service.metadata.end(); i++) { | 
| 57     printf("\t\t%s\n", i->c_str()); | 57     printf("\t\t%s\n", i->c_str()); | 
| 58   } | 58   } | 
| 59 | 59 | 
| 60   if (service.ip_address != net::IPAddressNumber()) { | 60   if (service.ip_address.IsValid()) { | 
| 61     printf("\tIP Address: %s\n", net::IPAddressToString( | 61     printf("\tIP Address: %s\n", service.ip_address.ToString().c_str()); | 
| 62         service.ip_address).c_str()); |  | 
| 63   } | 62   } | 
| 64 } | 63 } | 
| 65 | 64 | 
| 66 ServiceTypePrinter::ServiceTypePrinter(ServiceDiscoveryClient* client, | 65 ServiceTypePrinter::ServiceTypePrinter(ServiceDiscoveryClient* client, | 
| 67                                        const std::string& service_type) | 66                                        const std::string& service_type) | 
| 68     : client_(client)  { | 67     : client_(client)  { | 
| 69   watcher_ = client_->CreateServiceWatcher( | 68   watcher_ = client_->CreateServiceWatcher( | 
| 70       service_type, base::Bind(&ServiceTypePrinter::OnServiceUpdated, | 69       service_type, base::Bind(&ServiceTypePrinter::OnServiceUpdated, | 
| 71                                base::Unretained(this))); | 70                                base::Unretained(this))); | 
| 72 } | 71 } | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 113   { | 112   { | 
| 114     // To guarantee/make explicit the ordering constraint. | 113     // To guarantee/make explicit the ordering constraint. | 
| 115     local_discovery::ServiceTypePrinter print_changes( | 114     local_discovery::ServiceTypePrinter print_changes( | 
| 116         service_discovery_client.get(), | 115         service_discovery_client.get(), | 
| 117         std::string(argv[1]) + "._tcp.local"); | 116         std::string(argv[1]) + "._tcp.local"); | 
| 118 | 117 | 
| 119     print_changes.Start(); | 118     print_changes.Start(); | 
| 120     message_loop.Run(); | 119     message_loop.Run(); | 
| 121   } | 120   } | 
| 122 } | 121 } | 
| OLD | NEW | 
|---|