Chromium Code Reviews| Index: chrome/browser/media/router/discovery/mdns/dns_sd_registry.h |
| diff --git a/chrome/browser/media/router/discovery/mdns/dns_sd_registry.h b/chrome/browser/media/router/discovery/mdns/dns_sd_registry.h |
| index 24962c98083eb87ea660ecde9ae776c66a12d04c..03c19f3ddc5d39c4dd6c9935662110f4ca4a1f7b 100644 |
| --- a/chrome/browser/media/router/discovery/mdns/dns_sd_registry.h |
| +++ b/chrome/browser/media/router/discovery/mdns/dns_sd_registry.h |
| @@ -12,13 +12,21 @@ |
| #include <vector> |
| #include "base/macros.h" |
| +#include "base/memory/singleton.h" |
| #include "base/observer_list.h" |
| +#include "base/threading/thread_checker.h" |
| #include "chrome/browser/media/router/discovery/mdns/dns_sd_delegate.h" |
| namespace local_discovery { |
| class ServiceDiscoverySharedClient; |
| } |
| +namespace extensions { |
| +namespace { |
| +class MockDnsSdRegistry; |
|
mark a. foltz
2017/05/11 23:22:24
This is a sign this mock should live in c/b/media/
zhaobin
2017/05/12 17:35:00
Done.
|
| +} |
| +} // namespace extensions |
| + |
| namespace media_router { |
| class DnsSdDeviceLister; |
| @@ -38,9 +46,7 @@ class DnsSdRegistry : public DnsSdDelegate { |
| virtual ~DnsSdObserver() {} |
| }; |
| - DnsSdRegistry(); |
| - explicit DnsSdRegistry(local_discovery::ServiceDiscoverySharedClient* client); |
| - virtual ~DnsSdRegistry(); |
| + static DnsSdRegistry* GetInstance(); |
| // Publishes the current device list for |service_type| to event listeners |
| // whose event filter matches the service type. |
| @@ -108,12 +114,21 @@ class DnsSdRegistry : public DnsSdDelegate { |
| std::map<std::string, std::unique_ptr<ServiceTypeData>> service_data_map_; |
| private: |
| + friend struct base::DefaultSingletonTraits<DnsSdRegistry>; |
| + friend class extensions::MockDnsSdRegistry; |
| + friend class TestDnsSdRegistry; |
| + |
| + DnsSdRegistry(); |
| + explicit DnsSdRegistry(local_discovery::ServiceDiscoverySharedClient* client); |
| + virtual ~DnsSdRegistry(); |
| + |
| void DispatchApiEvent(const std::string& service_type); |
| bool IsRegistered(const std::string& service_type); |
| scoped_refptr<local_discovery::ServiceDiscoverySharedClient> |
| service_discovery_client_; |
| base::ObserverList<DnsSdObserver> observers_; |
| + base::ThreadChecker thread_checker_; |
| DISALLOW_COPY_AND_ASSIGN(DnsSdRegistry); |
| }; |