OLD | NEW |
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> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/containers/hash_tables.h" | |
16 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 16 #include "base/macros.h" |
18 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
19 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
20 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
21 #include "chrome/browser/media/router/discovery/dial/dial_service.h" | 20 #include "chrome/browser/media/router/discovery/dial/dial_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
23 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
24 | 23 |
25 namespace base { | 24 namespace base { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 92 |
94 protected: | 93 protected: |
95 // Returns a new instance of the DIAL service. Overridden by tests. | 94 // Returns a new instance of the DIAL service. Overridden by tests. |
96 virtual std::unique_ptr<DialService> CreateDialService(); | 95 virtual std::unique_ptr<DialService> CreateDialService(); |
97 virtual void ClearDialService(); | 96 virtual void ClearDialService(); |
98 | 97 |
99 // The DIAL service. Periodic discovery is active when this is not NULL. | 98 // The DIAL service. Periodic discovery is active when this is not NULL. |
100 std::unique_ptr<DialService> dial_; | 99 std::unique_ptr<DialService> dial_; |
101 | 100 |
102 private: | 101 private: |
103 using DeviceByIdMap = | 102 using DeviceByIdMap = std::map<std::string, std::unique_ptr<DialDeviceData>>; |
104 base::hash_map<std::string, std::unique_ptr<DialDeviceData>>; | |
105 using DeviceByLabelMap = std::map<std::string, DialDeviceData*>; | 103 using DeviceByLabelMap = std::map<std::string, DialDeviceData*>; |
106 | 104 |
107 friend class MockDialRegistry; | 105 friend class MockDialRegistry; |
108 friend class TestDialRegistry; | 106 friend class TestDialRegistry; |
109 friend struct base::DefaultSingletonTraits<DialRegistry>; | 107 friend struct base::DefaultSingletonTraits<DialRegistry>; |
110 | 108 |
111 DialRegistry(); | 109 DialRegistry(); |
112 ~DialRegistry() override; | 110 ~DialRegistry() override; |
113 | 111 |
114 // DialService::Observer: | 112 // DialService::Observer: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 TestRemovingListenerDoesNotClearList); | 204 TestRemovingListenerDoesNotClearList); |
207 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost); | 205 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost); |
208 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, | 206 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, |
209 TestNetworkEventConnectionRestored); | 207 TestNetworkEventConnectionRestored); |
210 DISALLOW_COPY_AND_ASSIGN(DialRegistry); | 208 DISALLOW_COPY_AND_ASSIGN(DialRegistry); |
211 }; | 209 }; |
212 | 210 |
213 } // namespace media_router | 211 } // namespace media_router |
214 | 212 |
215 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_ | 213 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_ |
OLD | NEW |