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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_registry.h

Issue 2583853004: [chrome.dial] Adds chrome.dial.fetchDeviceDecription API. (Closed)
Patch Set: Fix initialization Created 3 years, 11 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_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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Called by the DIAL API when event listeners are added or removed. The dial 65 // Called by the DIAL API when event listeners are added or removed. The dial
66 // service is started after the first listener is added and stopped after the 66 // service is started after the first listener is added and stopped after the
67 // last listener is removed. 67 // last listener is removed.
68 void OnListenerAdded(); 68 void OnListenerAdded();
69 void OnListenerRemoved(); 69 void OnListenerRemoved();
70 70
71 // Called by the DIAL API to try to kickoff a discovery if there is not one 71 // Called by the DIAL API to try to kickoff a discovery if there is not one
72 // already active. 72 // already active.
73 bool DiscoverNow(); 73 bool DiscoverNow();
74 74
75 // Returns the URL of the device description for the device identified by
76 // |label|, or an empty GURL if no such device exists.
77 GURL GetDeviceDescriptionURL(const std::string& label) const;
78
79 // Adds a device directly to the registry as if it was discovered. For tests
80 // only. Note that if discovery is actually started, this device will be
81 // removed by PruneExpiredDevices().
82 void AddDeviceForTest(const DialDeviceData& device_data);
83
75 protected: 84 protected:
76 // Returns a new instance of the DIAL service. Overridden by tests. 85 // Returns a new instance of the DIAL service. Overridden by tests.
77 virtual std::unique_ptr<DialService> CreateDialService(); 86 virtual std::unique_ptr<DialService> CreateDialService();
78 virtual void ClearDialService(); 87 virtual void ClearDialService();
79 88
80 // Returns the current time. Overridden by tests. 89 // Returns the current time. Overridden by tests.
81 virtual base::Time Now() const; 90 virtual base::Time Now() const;
82 91
83 // The DIAL service. Periodic discovery is active when this is not NULL. 92 // The DIAL service. Periodic discovery is active when this is not NULL.
84 std::unique_ptr<DialService> dial_; 93 std::unique_ptr<DialService> dial_;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 TestRemovingListenerDoesNotClearList); 189 TestRemovingListenerDoesNotClearList);
181 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost); 190 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNetworkEventConnectionLost);
182 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, 191 FRIEND_TEST_ALL_PREFIXES(DialRegistryTest,
183 TestNetworkEventConnectionRestored); 192 TestNetworkEventConnectionRestored);
184 DISALLOW_COPY_AND_ASSIGN(DialRegistry); 193 DISALLOW_COPY_AND_ASSIGN(DialRegistry);
185 }; 194 };
186 195
187 } // namespace extensions 196 } // namespace extensions
188 197
189 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_ 198 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698