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

Unified Diff: chrome/browser/extensions/api/dial/dial_registry.h

Issue 2702503003: [Dial] Refactor DialRegistry and DeviceDescriptionFetcher so they can be used by MediaSinkService (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/dial/dial_registry.h
diff --git a/chrome/browser/extensions/api/dial/dial_registry.h b/chrome/browser/extensions/api/dial/dial_registry.h
index e43d207bff830aa3fbecae52d6ea9a674cc9cc01..fb39d420d3808edd7ac51911037978af469c5e5f 100644
--- a/chrome/browser/extensions/api/dial/dial_registry.h
+++ b/chrome/browser/extensions/api/dial/dial_registry.h
@@ -70,6 +70,10 @@ class DialRegistry : public DialService::Observer,
void OnListenerAdded();
void OnListenerRemoved();
+ // This class does not take ownership of observer.
+ void RegisterObserver(Observer* observer);
+ void UnregisterObserver(Observer* observer);
+
// Called by the DIAL API to try to kickoff a discovery if there is not one
// already active.
bool DiscoverNow();
@@ -111,6 +115,10 @@ class DialRegistry : public DialService::Observer,
void OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) override;
+ // Notify all observers about DialDeviceEvent or DialError.
+ void OnDialDeviceEvent(const DeviceList& devices);
+ void OnDialError(DialErrorCode type);
+
// Starts and stops periodic discovery. Periodic discovery is done when there
// are registered event listeners.
void StartPeriodicDiscovery();
@@ -178,7 +186,7 @@ class DialRegistry : public DialService::Observer,
// Interface from which the DIAL API is notified of DIAL device events. the
// DIAL API owns this DIAL registry.
- Observer* const dial_api_;
+ std::set<Observer*> observers_;
mark a. foltz 2017/03/01 21:44:00 Can you use base::ObserverList?
zhaobin 2017/03/02 07:04:35 Done.
FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestAddRemoveListeners);
FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNoDevicesDiscovered);

Powered by Google App Engine
This is Rietveld 408576698