| 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_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 public: | 54 public: |
| 55 ServiceWatcherImpl(const std::string& service_type, | 55 ServiceWatcherImpl(const std::string& service_type, |
| 56 const ServiceWatcher::UpdatedCallback& callback, | 56 const ServiceWatcher::UpdatedCallback& callback, |
| 57 net::MDnsClient* mdns_client); | 57 net::MDnsClient* mdns_client); |
| 58 // Listening will automatically stop when the destructor is called. | 58 // Listening will automatically stop when the destructor is called. |
| 59 ~ServiceWatcherImpl() override; | 59 ~ServiceWatcherImpl() override; |
| 60 | 60 |
| 61 // ServiceWatcher implementation: | 61 // ServiceWatcher implementation: |
| 62 void Start() override; | 62 void Start() override; |
| 63 | 63 |
| 64 void DiscoverNewServices(bool force_update) override; | 64 void DiscoverNewServices() override; |
| 65 | 65 |
| 66 void SetActivelyRefreshServices(bool actively_refresh_services) override; | 66 void SetActivelyRefreshServices(bool actively_refresh_services) override; |
| 67 | 67 |
| 68 std::string GetServiceType() const override; | 68 std::string GetServiceType() const override; |
| 69 | 69 |
| 70 void OnRecordUpdate(net::MDnsListener::UpdateType update, | 70 void OnRecordUpdate(net::MDnsListener::UpdateType update, |
| 71 const net::RecordParsed* record) override; | 71 const net::RecordParsed* record) override; |
| 72 | 72 |
| 73 void OnNsecRecord(const std::string& name, unsigned rrtype) override; | 73 void OnNsecRecord(const std::string& name, unsigned rrtype) override; |
| 74 | 74 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 using ServiceListenersMap = | 123 using ServiceListenersMap = |
| 124 std::map<std::string, std::unique_ptr<ServiceListeners>>; | 124 std::map<std::string, std::unique_ptr<ServiceListeners>>; |
| 125 | 125 |
| 126 void ReadCachedServices(); | 126 void ReadCachedServices(); |
| 127 void AddService(const std::string& service); | 127 void AddService(const std::string& service); |
| 128 void RemovePTR(const std::string& service); | 128 void RemovePTR(const std::string& service); |
| 129 void RemoveSRV(const std::string& service); | 129 void RemoveSRV(const std::string& service); |
| 130 void AddSRV(const std::string& service); | 130 void AddSRV(const std::string& service); |
| 131 bool CreateTransaction(bool active, | 131 bool CreateTransaction(bool active, |
| 132 bool alert_existing_services, | 132 bool alert_existing_services, |
| 133 bool force_refresh, | |
| 134 std::unique_ptr<net::MDnsTransaction>* transaction); | 133 std::unique_ptr<net::MDnsTransaction>* transaction); |
| 135 | 134 |
| 136 void DeferUpdate(ServiceWatcher::UpdateType update_type, | 135 void DeferUpdate(ServiceWatcher::UpdateType update_type, |
| 137 const std::string& service_name); | 136 const std::string& service_name); |
| 138 void DeliverDeferredUpdate(ServiceWatcher::UpdateType update_type, | 137 void DeliverDeferredUpdate(ServiceWatcher::UpdateType update_type, |
| 139 const std::string& service_name); | 138 const std::string& service_name); |
| 140 | 139 |
| 141 void ScheduleQuery(int timeout_seconds); | 140 void ScheduleQuery(int timeout_seconds); |
| 142 | 141 |
| 143 void SendQuery(int next_timeout_seconds, bool force_update); | 142 void SendQuery(int next_timeout_seconds); |
| 144 | 143 |
| 145 const std::string service_type_; | 144 const std::string service_type_; |
| 146 ServiceListenersMap services_; | 145 ServiceListenersMap services_; |
| 147 std::unique_ptr<net::MDnsTransaction> transaction_network_; | 146 std::unique_ptr<net::MDnsTransaction> transaction_network_; |
| 148 std::unique_ptr<net::MDnsTransaction> transaction_cache_; | 147 std::unique_ptr<net::MDnsTransaction> transaction_cache_; |
| 149 std::unique_ptr<net::MDnsListener> listener_; | 148 std::unique_ptr<net::MDnsListener> listener_; |
| 150 | 149 |
| 151 ServiceWatcher::UpdatedCallback callback_; | 150 ServiceWatcher::UpdatedCallback callback_; |
| 152 bool started_; | 151 bool started_; |
| 153 bool actively_refresh_services_; | 152 bool actively_refresh_services_; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 262 |
| 264 base::CancelableCallback<void()> timeout_callback_; | 263 base::CancelableCallback<void()> timeout_callback_; |
| 265 | 264 |
| 266 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverImpl); | 265 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverImpl); |
| 267 }; | 266 }; |
| 268 | 267 |
| 269 | 268 |
| 270 } // namespace local_discovery | 269 } // namespace local_discovery |
| 271 | 270 |
| 272 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ | 271 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_IMPL_H_ |
| OLD | NEW |