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

Side by Side Diff: chrome/browser/extensions/api/mdns/dns_sd_registry.h

Issue 2466523002: Remove some linked_ptr c/b/extension (Closed)
Patch Set: review Created 4 years, 1 month 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
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_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/linked_ptr.h"
16 #include "base/observer_list.h" 15 #include "base/observer_list.h"
17 #include "chrome/browser/extensions/api/mdns/dns_sd_delegate.h" 16 #include "chrome/browser/extensions/api/mdns/dns_sd_delegate.h"
18 17
19 namespace local_discovery { 18 namespace local_discovery {
20 class ServiceDiscoverySharedClient; 19 class ServiceDiscoverySharedClient;
21 class ServiceDiscoveryClient; 20 class ServiceDiscoveryClient;
22 } 21 }
23 22
24 namespace extensions { 23 namespace extensions {
25 24
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 86
88 const DnsSdRegistry::DnsSdServiceList& GetServiceList(); 87 const DnsSdRegistry::DnsSdServiceList& GetServiceList();
89 88
90 private: 89 private:
91 int ref_count; 90 int ref_count;
92 std::unique_ptr<DnsSdDeviceLister> lister_; 91 std::unique_ptr<DnsSdDeviceLister> lister_;
93 DnsSdRegistry::DnsSdServiceList service_list_; 92 DnsSdRegistry::DnsSdServiceList service_list_;
94 DISALLOW_COPY_AND_ASSIGN(ServiceTypeData); 93 DISALLOW_COPY_AND_ASSIGN(ServiceTypeData);
95 }; 94 };
96 95
97 // Maps service types to associated data such as listers and service lists.
98 typedef std::map<std::string, linked_ptr<ServiceTypeData> >
99 DnsSdServiceTypeDataMap;
100
101 virtual DnsSdDeviceLister* CreateDnsSdDeviceLister( 96 virtual DnsSdDeviceLister* CreateDnsSdDeviceLister(
102 DnsSdDelegate* delegate, 97 DnsSdDelegate* delegate,
103 const std::string& service_type, 98 const std::string& service_type,
104 local_discovery::ServiceDiscoverySharedClient* discovery_client); 99 local_discovery::ServiceDiscoverySharedClient* discovery_client);
105 100
106 // DnsSdDelegate implementation: 101 // DnsSdDelegate implementation:
107 void ServiceChanged(const std::string& service_type, 102 void ServiceChanged(const std::string& service_type,
108 bool added, 103 bool added,
109 const DnsSdService& service) override; 104 const DnsSdService& service) override;
110 void ServiceRemoved(const std::string& service_type, 105 void ServiceRemoved(const std::string& service_type,
111 const std::string& service_name) override; 106 const std::string& service_name) override;
112 void ServicesFlushed(const std::string& service_type) override; 107 void ServicesFlushed(const std::string& service_type) override;
113 108
114 DnsSdServiceTypeDataMap service_data_map_; 109 std::map<std::string, std::unique_ptr<ServiceTypeData>> service_data_map_;
115 110
116 private: 111 private:
117 void DispatchApiEvent(const std::string& service_type); 112 void DispatchApiEvent(const std::string& service_type);
118 bool IsRegistered(const std::string& service_type); 113 bool IsRegistered(const std::string& service_type);
119 114
120 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> 115 scoped_refptr<local_discovery::ServiceDiscoverySharedClient>
121 service_discovery_client_; 116 service_discovery_client_;
122 base::ObserverList<DnsSdObserver> observers_; 117 base::ObserverList<DnsSdObserver> observers_;
123 118
124 DISALLOW_COPY_AND_ASSIGN(DnsSdRegistry); 119 DISALLOW_COPY_AND_ASSIGN(DnsSdRegistry);
125 }; 120 };
126 121
127 } // namespace extensions 122 } // namespace extensions
128 123
129 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_ 124 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/gcd_private/gcd_private_api.cc ('k') | chrome/browser/extensions/api/mdns/dns_sd_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698