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_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_DNS_SD_DELEGATE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DELEGATE_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_DNS_SD_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 namespace extensions { | 11 namespace media_router { |
12 | 12 |
13 struct DnsSdService { | 13 struct DnsSdService { |
14 std::string service_name; | 14 std::string service_name; |
15 std::string service_host_port; | 15 std::string service_host_port; |
16 std::string ip_address; | 16 std::string ip_address; |
17 std::vector<std::string> service_data; | 17 std::vector<std::string> service_data; |
18 | 18 |
19 DnsSdService(); | 19 DnsSdService(); |
20 DnsSdService(const DnsSdService& other); | 20 DnsSdService(const DnsSdService& other); |
21 virtual ~DnsSdService(); | 21 virtual ~DnsSdService(); |
22 | 22 |
23 bool operator==(const DnsSdService& other) const { | 23 bool operator==(const DnsSdService& other) const { |
24 return service_name == other.service_name && | 24 return service_name == other.service_name && |
25 service_host_port == other.service_host_port && | 25 service_host_port == other.service_host_port && |
26 ip_address == other.ip_address && | 26 ip_address == other.ip_address && service_data == other.service_data; |
27 service_data == other.service_data; | |
28 } | 27 } |
29 | 28 |
30 bool operator!=(const DnsSdService& other) const { | 29 bool operator!=(const DnsSdService& other) const { return !(*this == other); } |
31 return !(*this == other); | |
32 } | |
33 }; | 30 }; |
34 | 31 |
35 // Delegate that is notified when a watched service is added, updated or | 32 // Delegate that is notified when a watched service is added, updated or |
36 // removed. | 33 // removed. |
37 class DnsSdDelegate { | 34 class DnsSdDelegate { |
38 public: | 35 public: |
39 virtual void ServiceChanged(const std::string& service_type, | 36 virtual void ServiceChanged(const std::string& service_type, |
40 bool added, | 37 bool added, |
41 const DnsSdService& service) = 0; | 38 const DnsSdService& service) = 0; |
42 virtual void ServiceRemoved(const std::string& service_type, | 39 virtual void ServiceRemoved(const std::string& service_type, |
43 const std::string& service_name) = 0; | 40 const std::string& service_name) = 0; |
44 virtual void ServicesFlushed(const std::string& service_type) = 0; | 41 virtual void ServicesFlushed(const std::string& service_type) = 0; |
45 }; | 42 }; |
46 | 43 |
47 } // namespace extensions | 44 } // namespace media_router |
48 | 45 |
49 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DELEGATE_H_ | 46 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_DNS_SD_DELEGATE_H_ |
OLD | NEW |