Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / local_discovery / service_discovery_client_mdns.h
blob2a3854a586ea8b5f44a047a189511d9e3579ad24
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_MDNS_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_MDNS_H_
8 #include <string>
10 #include "base/cancelable_callback.h"
11 #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
12 #include "chrome/common/local_discovery/service_discovery_client.h"
13 #include "net/base/network_change_notifier.h"
15 namespace local_discovery {
17 class ServiceDiscoveryHostClient;
19 class ServiceDiscoveryClientMdns
20 : public ServiceDiscoverySharedClient,
21 public net::NetworkChangeNotifier::NetworkChangeObserver {
22 public:
23 ServiceDiscoveryClientMdns();
25 // ServiceDiscoveryClient implementation.
26 virtual scoped_ptr<ServiceWatcher> CreateServiceWatcher(
27 const std::string& service_type,
28 const ServiceWatcher::UpdatedCallback& callback) OVERRIDE;
29 virtual scoped_ptr<ServiceResolver> CreateServiceResolver(
30 const std::string& service_name,
31 const ServiceResolver::ResolveCompleteCallback& callback) OVERRIDE;
32 virtual scoped_ptr<LocalDomainResolver> CreateLocalDomainResolver(
33 const std::string& domain,
34 net::AddressFamily address_family,
35 const LocalDomainResolver::IPAddressCallback& callback) OVERRIDE;
37 // net::NetworkChangeNotifier::NetworkChangeObserver implementation.
38 virtual void OnNetworkChanged(
39 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
41 private:
42 friend class base::RefCounted<ServiceDiscoveryClientMdns>;
44 virtual ~ServiceDiscoveryClientMdns();
45 void ScheduleStartNewClient();
46 void StartNewClient();
47 void ReportSuccess();
49 scoped_refptr<ServiceDiscoveryHostClient> host_client_;
50 int restart_attempts_;
51 base::WeakPtrFactory<ServiceDiscoveryClientMdns> weak_ptr_factory_;
53 DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryClientMdns);
56 } // namespace local_discovery
58 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_MDNS_H_