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 CHROME_TOOLS_SERVICE_DISCOVERY_SNIFFER_SERVICE_DISCOVERY_SNIFFER_H_ | 5 #ifndef CHROME_TOOLS_SERVICE_DISCOVERY_SNIFFER_SERVICE_DISCOVERY_SNIFFER_H_ |
6 #define CHROME_TOOLS_SERVICE_DISCOVERY_SNIFFER_SERVICE_DISCOVERY_SNIFFER_H_ | 6 #define CHROME_TOOLS_SERVICE_DISCOVERY_SNIFFER_SERVICE_DISCOVERY_SNIFFER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 void Added(); | 25 void Added(); |
26 void Changed(); | 26 void Changed(); |
27 void Removed(); | 27 void Removed(); |
28 | 28 |
29 private: | 29 private: |
30 void OnServiceResolved(ServiceResolver::RequestStatus status, | 30 void OnServiceResolved(ServiceResolver::RequestStatus status, |
31 const ServiceDescription& service); | 31 const ServiceDescription& service); |
32 | 32 |
33 bool changed_; | 33 bool changed_; |
34 scoped_ptr<ServiceResolver> service_resolver_; | 34 std::unique_ptr<ServiceResolver> service_resolver_; |
Lei Zhang
2016/04/19 01:35:42
IWYU
dcheng
2016/04/19 03:51:33
Done.
| |
35 | 35 |
36 DISALLOW_COPY_AND_ASSIGN(ServicePrinter); | 36 DISALLOW_COPY_AND_ASSIGN(ServicePrinter); |
37 }; | 37 }; |
38 | 38 |
39 // Monitors a service type and prints information regarding all services on it | 39 // Monitors a service type and prints information regarding all services on it |
40 // to the console. |client| must outlive the ServiceTypePrinter. | 40 // to the console. |client| must outlive the ServiceTypePrinter. |
41 class ServiceTypePrinter { | 41 class ServiceTypePrinter { |
42 public: | 42 public: |
43 ServiceTypePrinter(ServiceDiscoveryClient* client, | 43 ServiceTypePrinter(ServiceDiscoveryClient* client, |
44 const std::string& service_type); | 44 const std::string& service_type); |
45 virtual ~ServiceTypePrinter(); | 45 virtual ~ServiceTypePrinter(); |
46 | 46 |
47 void Start(); | 47 void Start(); |
48 void OnServiceUpdated(ServiceWatcher::UpdateType, | 48 void OnServiceUpdated(ServiceWatcher::UpdateType, |
49 const std::string& service_name); | 49 const std::string& service_name); |
50 | 50 |
51 private: | 51 private: |
52 typedef std::map<std::string, linked_ptr<ServicePrinter> > ServiceMap; | 52 typedef std::map<std::string, linked_ptr<ServicePrinter> > ServiceMap; |
53 | 53 |
54 ServiceMap services_; | 54 ServiceMap services_; |
55 scoped_ptr<ServiceWatcher> watcher_; | 55 std::unique_ptr<ServiceWatcher> watcher_; |
56 ServiceDiscoveryClient* client_; | 56 ServiceDiscoveryClient* client_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(ServiceTypePrinter); | 58 DISALLOW_COPY_AND_ASSIGN(ServiceTypePrinter); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace local_discovery | 61 } // namespace local_discovery |
62 | 62 |
63 #endif // CHROME_TOOLS_SERVICE_DISCOVERY_SNIFFER_SERVICE_DISCOVERY_SNIFFER_H_ | 63 #endif // CHROME_TOOLS_SERVICE_DISCOVERY_SNIFFER_SERVICE_DISCOVERY_SNIFFER_H_ |
OLD | NEW |