Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: chrome/browser/local_discovery/service_discovery_client_utility.h

Issue 251023005: Renamed ServiceDiscoveryClientMdns to ServiceDiscoveryClientUtility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sat 04/26/2014 18:41:53.09 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_MDNS_H_ 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_UTILITY_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_MDNS_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_UTILITY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
11 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" 11 #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
12 #include "chrome/common/local_discovery/service_discovery_client.h" 12 #include "chrome/common/local_discovery/service_discovery_client.h"
13 #include "net/base/network_change_notifier.h" 13 #include "net/base/network_change_notifier.h"
14 14
15 namespace local_discovery { 15 namespace local_discovery {
16 16
17 class ServiceDiscoveryHostClient; 17 class ServiceDiscoveryHostClient;
18 18
19 class ServiceDiscoveryClientMdns 19 // Wrapper for ServiceDiscoveryHostClient to hide restarting of utility process
20 // from mdns users.
21 class ServiceDiscoveryClientUtility
20 : public ServiceDiscoverySharedClient, 22 : public ServiceDiscoverySharedClient,
21 public net::NetworkChangeNotifier::NetworkChangeObserver { 23 public net::NetworkChangeNotifier::NetworkChangeObserver {
22 public: 24 public:
23 ServiceDiscoveryClientMdns(); 25 ServiceDiscoveryClientUtility();
24 26
25 // ServiceDiscoveryClient implementation. 27 // ServiceDiscoveryClient implementation.
26 virtual scoped_ptr<ServiceWatcher> CreateServiceWatcher( 28 virtual scoped_ptr<ServiceWatcher> CreateServiceWatcher(
27 const std::string& service_type, 29 const std::string& service_type,
28 const ServiceWatcher::UpdatedCallback& callback) OVERRIDE; 30 const ServiceWatcher::UpdatedCallback& callback) OVERRIDE;
29 virtual scoped_ptr<ServiceResolver> CreateServiceResolver( 31 virtual scoped_ptr<ServiceResolver> CreateServiceResolver(
30 const std::string& service_name, 32 const std::string& service_name,
31 const ServiceResolver::ResolveCompleteCallback& callback) OVERRIDE; 33 const ServiceResolver::ResolveCompleteCallback& callback) OVERRIDE;
32 virtual scoped_ptr<LocalDomainResolver> CreateLocalDomainResolver( 34 virtual scoped_ptr<LocalDomainResolver> CreateLocalDomainResolver(
33 const std::string& domain, 35 const std::string& domain,
34 net::AddressFamily address_family, 36 net::AddressFamily address_family,
35 const LocalDomainResolver::IPAddressCallback& callback) OVERRIDE; 37 const LocalDomainResolver::IPAddressCallback& callback) OVERRIDE;
36 38
37 // net::NetworkChangeNotifier::NetworkChangeObserver implementation. 39 // net::NetworkChangeNotifier::NetworkChangeObserver implementation.
38 virtual void OnNetworkChanged( 40 virtual void OnNetworkChanged(
39 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; 41 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
40 42
41 private: 43 private:
42 friend class base::RefCounted<ServiceDiscoveryClientMdns>; 44 friend class base::RefCounted<ServiceDiscoveryClientUtility>;
43 45
44 virtual ~ServiceDiscoveryClientMdns(); 46 virtual ~ServiceDiscoveryClientUtility();
45 void ScheduleStartNewClient(); 47 void ScheduleStartNewClient();
46 void StartNewClient(); 48 void StartNewClient();
47 void ReportSuccess(); 49 void ReportSuccess();
48 50
49 scoped_refptr<ServiceDiscoveryHostClient> host_client_; 51 scoped_refptr<ServiceDiscoveryHostClient> host_client_;
50 int restart_attempts_; 52 int restart_attempts_;
51 base::WeakPtrFactory<ServiceDiscoveryClientMdns> weak_ptr_factory_; 53 base::WeakPtrFactory<ServiceDiscoveryClientUtility> weak_ptr_factory_;
52 54
53 DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryClientMdns); 55 DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryClientUtility);
54 }; 56 };
55 57
56 } // namespace local_discovery 58 } // namespace local_discovery
57 59
58 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_MDNS_H_ 60 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_UTILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698