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_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Called by the DIAL API when event listeners are added or removed. The dial | 67 // Called by the DIAL API when event listeners are added or removed. The dial |
68 // service is started after the first listener is added and stopped after the | 68 // service is started after the first listener is added and stopped after the |
69 // last listener is removed. | 69 // last listener is removed. |
70 void OnListenerAdded(); | 70 void OnListenerAdded(); |
71 void OnListenerRemoved(); | 71 void OnListenerRemoved(); |
72 | 72 |
73 // Called by the DIAL API to try to kickoff a discovery if there is not one | 73 // Called by the DIAL API to try to kickoff a discovery if there is not one |
74 // already active. | 74 // already active. |
75 bool DiscoverNow(); | 75 bool DiscoverNow(); |
76 | 76 |
| 77 // Returns the URL of the device description for the device identified by |
| 78 // |label|, or an empty GURL if no such device exists. |
| 79 GURL GetDeviceDescriptionURL(const std::string& label) const; |
| 80 |
| 81 // Adds a device directly to the registry as if it was discovered. For tests |
| 82 // only. Note that if discovery is actually started, this device will be |
| 83 // removed by PruneExpiredDevices(). |
| 84 void AddDeviceForTest(const DialDeviceData& device_data); |
| 85 |
77 protected: | 86 protected: |
78 // Returns a new instance of the DIAL service. Overridden by tests. | 87 // Returns a new instance of the DIAL service. Overridden by tests. |
79 virtual std::unique_ptr<DialService> CreateDialService(); | 88 virtual std::unique_ptr<DialService> CreateDialService(); |
80 virtual void ClearDialService(); | 89 virtual void ClearDialService(); |
81 | 90 |
82 // Returns the current time. Overridden by tests. | 91 // Returns the current time. Overridden by tests. |
83 virtual base::Time Now() const; | 92 virtual base::Time Now() const; |
84 | 93 |
85 // The DIAL service. Periodic discovery is active when this is not NULL. | 94 // The DIAL service. Periodic discovery is active when this is not NULL. |
86 std::unique_ptr<DialService> dial_; | 95 std::unique_ptr<DialService> dial_; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, | 193 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, |
185 TestNetworkEventConnectionRestored); | 194 TestNetworkEventConnectionRestored); |
186 DISALLOW_COPY_AND_ASSIGN(DialRegistry); | 195 DISALLOW_COPY_AND_ASSIGN(DialRegistry); |
187 }; | 196 }; |
188 | 197 |
189 } // namespace dial | 198 } // namespace dial |
190 } // namespace api | 199 } // namespace api |
191 } // namespace extensions | 200 } // namespace extensions |
192 | 201 |
193 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ | 202 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ |
OLD | NEW |