| 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_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_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" | 15 #include "base/containers/hash_tables.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "base/timer/timer.h" | 21 #include "base/timer/timer.h" |
| 22 #include "chrome/browser/extensions/api/dial/dial_service.h" | 22 #include "chrome/browser/media/router/discovery/dial/dial_service.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "net/base/network_change_notifier.h" | 24 #include "net/base/network_change_notifier.h" |
| 25 | 25 |
| 26 namespace extensions { | 26 namespace media_router { |
| 27 namespace api { | |
| 28 namespace dial { | |
| 29 | 27 |
| 30 // Keeps track of devices that have responded to discovery requests and notifies | 28 // Keeps track of devices that have responded to discovery requests and notifies |
| 31 // the observer with an updated, complete set of active devices. The registry's | 29 // the observer with an updated, complete set of active devices. The registry's |
| 32 // observer (i.e., the Dial API) owns the registry instance. | 30 // observer (i.e., the Dial API) owns the registry instance. |
| 33 // DialRegistry lives on the IO thread. | 31 // DialRegistry lives on the IO thread. |
| 34 class DialRegistry : public DialService::Observer, | 32 class DialRegistry : public DialService::Observer, |
| 35 public net::NetworkChangeNotifier::NetworkChangeObserver { | 33 public net::NetworkChangeNotifier::NetworkChangeObserver { |
| 36 public: | 34 public: |
| 37 using DeviceList = std::vector<DialDeviceData>; | 35 using DeviceList = std::vector<DialDeviceData>; |
| 38 | 36 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestDeviceExpires); | 194 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestDeviceExpires); |
| 197 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestExpiredDeviceIsRediscovered); | 195 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestExpiredDeviceIsRediscovered); |
| 198 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, | 196 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, |
| 199 TestRemovingListenerDoesNotClearList); | 197 TestRemovingListenerDoesNotClearList); |
| 200 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost); | 198 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost); |
| 201 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, | 199 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, |
| 202 TestNetworkEventConnectionRestored); | 200 TestNetworkEventConnectionRestored); |
| 203 DISALLOW_COPY_AND_ASSIGN(DialRegistry); | 201 DISALLOW_COPY_AND_ASSIGN(DialRegistry); |
| 204 }; | 202 }; |
| 205 | 203 |
| 206 } // namespace dial | 204 } // namespace media_router |
| 207 } // namespace api | |
| 208 } // namespace extensions | |
| 209 | 205 |
| 210 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ | 206 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_H_ |
| OLD | NEW |