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

Side by Side Diff: chrome/browser/media/router/discovery/dial/dial_registry.h

Issue 2701633002: [Media Router] Add DialMediaSinkService and DeviceDescriptionService (Closed)
Patch Set: fix chromeos compile error Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 static DialRegistry* GetInstance(); 57 static DialRegistry* GetInstance();
58 58
59 // Called by the DIAL API when event listeners are added or removed. The dial 59 // Called by the DIAL API when event listeners are added or removed. The dial
60 // service is started after the first listener is added and stopped after the 60 // service is started after the first listener is added and stopped after the
61 // last listener is removed. 61 // last listener is removed.
62 void OnListenerAdded(); 62 void OnListenerAdded();
63 void OnListenerRemoved(); 63 void OnListenerRemoved();
64 64
65 // pass a reference of |observer| to allow it to notify on DIAL device events. 65 // pass a reference of |observer| to allow it to notify on DIAL device events.
66 // This class does not take ownership of |observer|. 66 // This class does not take ownership of observer.
67 void RegisterObserver(Observer* observer); 67 virtual void RegisterObserver(Observer* observer);
68 void UnregisterObserver(Observer* observer); 68 virtual void UnregisterObserver(Observer* observer);
69 69
70 // Called by the DIAL API to try to kickoff a discovery if there is not one 70 // Called by the DIAL API to try to kickoff a discovery if there is not one
71 // already active. 71 // already active.
72 bool DiscoverNow(); 72 bool DiscoverNow();
73 73
74 // Starts and stops periodic discovery. Periodic discovery is done when there 74 // Starts and stops periodic discovery. Periodic discovery is done when there
75 // are registered event listeners. 75 // are registered event listeners.
76 void StartPeriodicDiscovery(); 76 void StartPeriodicDiscovery();
77 void StopPeriodicDiscovery(); 77 void StopPeriodicDiscovery();
78 78
(...skipping 16 matching lines...) Expand all
95 95
96 // The DIAL service. Periodic discovery is active when this is not NULL. 96 // The DIAL service. Periodic discovery is active when this is not NULL.
97 std::unique_ptr<DialService> dial_; 97 std::unique_ptr<DialService> dial_;
98 98
99 private: 99 private:
100 using DeviceByIdMap = 100 using DeviceByIdMap =
101 base::hash_map<std::string, std::unique_ptr<DialDeviceData>>; 101 base::hash_map<std::string, std::unique_ptr<DialDeviceData>>;
102 using DeviceByLabelMap = std::map<std::string, DialDeviceData*>; 102 using DeviceByLabelMap = std::map<std::string, DialDeviceData*>;
103 103
104 friend class MockDialRegistry; 104 friend class MockDialRegistry;
105 friend class TestDialRegistry;
105 friend struct base::DefaultSingletonTraits<DialRegistry>; 106 friend struct base::DefaultSingletonTraits<DialRegistry>;
106 107
107 DialRegistry(); 108 DialRegistry();
108 ~DialRegistry() override; 109 ~DialRegistry() override;
109 110
110 // DialService::Observer: 111 // DialService::Observer:
111 void OnDiscoveryRequest(DialService* service) override; 112 void OnDiscoveryRequest(DialService* service) override;
112 void OnDeviceDiscovered(DialService* service, 113 void OnDeviceDiscovered(DialService* service,
113 const DialDeviceData& device) override; 114 const DialDeviceData& device) override;
114 void OnDiscoveryFinished(DialService* service) override; 115 void OnDiscoveryFinished(DialService* service) override;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 TestRemovingListenerDoesNotClearList); 201 TestRemovingListenerDoesNotClearList);
201 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost); 202 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost);
202 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, 203 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest,
203 TestNetworkEventConnectionRestored); 204 TestNetworkEventConnectionRestored);
204 DISALLOW_COPY_AND_ASSIGN(DialRegistry); 205 DISALLOW_COPY_AND_ASSIGN(DialRegistry);
205 }; 206 };
206 207
207 } // namespace media_router 208 } // namespace media_router
208 209
209 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_ 210 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698