| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ | 5 #ifndef CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ |
| 6 #define CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ | 6 #define CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class ServiceDiscoveryClientImpl : public ServiceDiscoveryClient { | 22 class ServiceDiscoveryClientImpl : public ServiceDiscoveryClient { |
| 23 public: | 23 public: |
| 24 // |mdns_client| must outlive the Service Discovery Client. | 24 // |mdns_client| must outlive the Service Discovery Client. |
| 25 explicit ServiceDiscoveryClientImpl(net::MDnsClient* mdns_client); | 25 explicit ServiceDiscoveryClientImpl(net::MDnsClient* mdns_client); |
| 26 virtual ~ServiceDiscoveryClientImpl(); | 26 virtual ~ServiceDiscoveryClientImpl(); |
| 27 | 27 |
| 28 // ServiceDiscoveryClient implementation: | 28 // ServiceDiscoveryClient implementation: |
| 29 virtual scoped_ptr<ServiceWatcher> CreateServiceWatcher( | 29 virtual scoped_ptr<ServiceWatcher> CreateServiceWatcher( |
| 30 const std::string& service_type, | 30 const std::string& service_type, |
| 31 const ServiceWatcher::UpdatedCallback& callback) OVERRIDE; | 31 const ServiceWatcher::UpdatedCallback& callback) override; |
| 32 | 32 |
| 33 virtual scoped_ptr<ServiceResolver> CreateServiceResolver( | 33 virtual scoped_ptr<ServiceResolver> CreateServiceResolver( |
| 34 const std::string& service_name, | 34 const std::string& service_name, |
| 35 const ServiceResolver::ResolveCompleteCallback& callback) OVERRIDE; | 35 const ServiceResolver::ResolveCompleteCallback& callback) override; |
| 36 | 36 |
| 37 virtual scoped_ptr<LocalDomainResolver> CreateLocalDomainResolver( | 37 virtual scoped_ptr<LocalDomainResolver> CreateLocalDomainResolver( |
| 38 const std::string& domain, | 38 const std::string& domain, |
| 39 net::AddressFamily address_family, | 39 net::AddressFamily address_family, |
| 40 const LocalDomainResolver::IPAddressCallback& callback) OVERRIDE; | 40 const LocalDomainResolver::IPAddressCallback& callback) override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 net::MDnsClient* mdns_client_; | 43 net::MDnsClient* mdns_client_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryClientImpl); | 45 DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryClientImpl); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class ServiceWatcherImpl : public ServiceWatcher, | 48 class ServiceWatcherImpl : public ServiceWatcher, |
| 49 public net::MDnsListener::Delegate, | 49 public net::MDnsListener::Delegate, |
| 50 public base::SupportsWeakPtr<ServiceWatcherImpl> { | 50 public base::SupportsWeakPtr<ServiceWatcherImpl> { |
| 51 public: | 51 public: |
| 52 ServiceWatcherImpl(const std::string& service_type, | 52 ServiceWatcherImpl(const std::string& service_type, |
| 53 const ServiceWatcher::UpdatedCallback& callback, | 53 const ServiceWatcher::UpdatedCallback& callback, |
| 54 net::MDnsClient* mdns_client); | 54 net::MDnsClient* mdns_client); |
| 55 // Listening will automatically stop when the destructor is called. | 55 // Listening will automatically stop when the destructor is called. |
| 56 virtual ~ServiceWatcherImpl(); | 56 virtual ~ServiceWatcherImpl(); |
| 57 | 57 |
| 58 // ServiceWatcher implementation: | 58 // ServiceWatcher implementation: |
| 59 virtual void Start() OVERRIDE; | 59 virtual void Start() override; |
| 60 | 60 |
| 61 virtual void DiscoverNewServices(bool force_update) OVERRIDE; | 61 virtual void DiscoverNewServices(bool force_update) override; |
| 62 | 62 |
| 63 virtual void SetActivelyRefreshServices( | 63 virtual void SetActivelyRefreshServices( |
| 64 bool actively_refresh_services) OVERRIDE; | 64 bool actively_refresh_services) override; |
| 65 | 65 |
| 66 virtual std::string GetServiceType() const OVERRIDE; | 66 virtual std::string GetServiceType() const override; |
| 67 | 67 |
| 68 virtual void OnRecordUpdate(net::MDnsListener::UpdateType update, | 68 virtual void OnRecordUpdate(net::MDnsListener::UpdateType update, |
| 69 const net::RecordParsed* record) OVERRIDE; | 69 const net::RecordParsed* record) override; |
| 70 | 70 |
| 71 virtual void OnNsecRecord(const std::string& name, unsigned rrtype) OVERRIDE; | 71 virtual void OnNsecRecord(const std::string& name, unsigned rrtype) override; |
| 72 | 72 |
| 73 virtual void OnCachePurged() OVERRIDE; | 73 virtual void OnCachePurged() override; |
| 74 | 74 |
| 75 virtual void OnTransactionResponse( | 75 virtual void OnTransactionResponse( |
| 76 scoped_ptr<net::MDnsTransaction>* transaction, | 76 scoped_ptr<net::MDnsTransaction>* transaction, |
| 77 net::MDnsTransaction::Result result, | 77 net::MDnsTransaction::Result result, |
| 78 const net::RecordParsed* record); | 78 const net::RecordParsed* record); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 struct ServiceListeners { | 81 struct ServiceListeners { |
| 82 ServiceListeners(const std::string& service_name, | 82 ServiceListeners(const std::string& service_name, |
| 83 ServiceWatcherImpl* watcher, | 83 ServiceWatcherImpl* watcher, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 : public ServiceResolver, | 158 : public ServiceResolver, |
| 159 public base::SupportsWeakPtr<ServiceResolverImpl> { | 159 public base::SupportsWeakPtr<ServiceResolverImpl> { |
| 160 public: | 160 public: |
| 161 ServiceResolverImpl(const std::string& service_name, | 161 ServiceResolverImpl(const std::string& service_name, |
| 162 const ServiceResolver::ResolveCompleteCallback& callback, | 162 const ServiceResolver::ResolveCompleteCallback& callback, |
| 163 net::MDnsClient* mdns_client); | 163 net::MDnsClient* mdns_client); |
| 164 | 164 |
| 165 virtual ~ServiceResolverImpl(); | 165 virtual ~ServiceResolverImpl(); |
| 166 | 166 |
| 167 // ServiceResolver implementation: | 167 // ServiceResolver implementation: |
| 168 virtual void StartResolving() OVERRIDE; | 168 virtual void StartResolving() override; |
| 169 | 169 |
| 170 virtual std::string GetName() const OVERRIDE; | 170 virtual std::string GetName() const override; |
| 171 | 171 |
| 172 private: | 172 private: |
| 173 // Respond to transaction finishing for SRV records. | 173 // Respond to transaction finishing for SRV records. |
| 174 void SrvRecordTransactionResponse(net::MDnsTransaction::Result status, | 174 void SrvRecordTransactionResponse(net::MDnsTransaction::Result status, |
| 175 const net::RecordParsed* record); | 175 const net::RecordParsed* record); |
| 176 | 176 |
| 177 // Respond to transaction finishing for TXT records. | 177 // Respond to transaction finishing for TXT records. |
| 178 void TxtRecordTransactionResponse(net::MDnsTransaction::Result status, | 178 void TxtRecordTransactionResponse(net::MDnsTransaction::Result status, |
| 179 const net::RecordParsed* record); | 179 const net::RecordParsed* record); |
| 180 | 180 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 class LocalDomainResolverImpl : public LocalDomainResolver { | 228 class LocalDomainResolverImpl : public LocalDomainResolver { |
| 229 public: | 229 public: |
| 230 LocalDomainResolverImpl(const std::string& domain, | 230 LocalDomainResolverImpl(const std::string& domain, |
| 231 net::AddressFamily address_family, | 231 net::AddressFamily address_family, |
| 232 const IPAddressCallback& callback, | 232 const IPAddressCallback& callback, |
| 233 net::MDnsClient* mdns_client); | 233 net::MDnsClient* mdns_client); |
| 234 virtual ~LocalDomainResolverImpl(); | 234 virtual ~LocalDomainResolverImpl(); |
| 235 | 235 |
| 236 virtual void Start() OVERRIDE; | 236 virtual void Start() override; |
| 237 | 237 |
| 238 const std::string& domain() { return domain_; } | 238 const std::string& domain() { return domain_; } |
| 239 | 239 |
| 240 private: | 240 private: |
| 241 void OnTransactionComplete( | 241 void OnTransactionComplete( |
| 242 net::MDnsTransaction::Result result, | 242 net::MDnsTransaction::Result result, |
| 243 const net::RecordParsed* record); | 243 const net::RecordParsed* record); |
| 244 | 244 |
| 245 scoped_ptr<net::MDnsTransaction> CreateTransaction(uint16 type); | 245 scoped_ptr<net::MDnsTransaction> CreateTransaction(uint16 type); |
| 246 | 246 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 264 | 264 |
| 265 base::CancelableCallback<void()> timeout_callback_; | 265 base::CancelableCallback<void()> timeout_callback_; |
| 266 | 266 |
| 267 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverImpl); | 267 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverImpl); |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 | 270 |
| 271 } // namespace local_discovery | 271 } // namespace local_discovery |
| 272 | 272 |
| 273 #endif // CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ | 273 #endif // CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ |
| OLD | NEW |