| Index: chrome/browser/media/router/media_sinks_observer.h
|
| diff --git a/chrome/browser/media/router/media_sinks_observer.h b/chrome/browser/media/router/media_sinks_observer.h
|
| index da9f517967fce9f322c9569b61bb961212ccfeb8..5a87f27321f890801f695c3e6378cec1a4d3459d 100644
|
| --- a/chrome/browser/media/router/media_sinks_observer.h
|
| +++ b/chrome/browser/media/router/media_sinks_observer.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/macros.h"
|
| #include "chrome/browser/media/router/media_sink.h"
|
| #include "chrome/browser/media/router/media_source.h"
|
| +#include "url/gurl.h"
|
|
|
| namespace media_router {
|
|
|
| @@ -23,9 +24,11 @@ class MediaRouter;
|
| // docs.google.com/document/d/1RDXdzi2y7lRuL08HAe-qlSJG2DMz2iH3gBzMs0IRR78
|
| class MediaSinksObserver {
|
| public:
|
| - // Constructs an observer that will observe for sinks compatible
|
| + // Constructs an observer from |origin| that will observe for sinks compatible
|
| // with |source|.
|
| - MediaSinksObserver(MediaRouter* router, const MediaSource& source);
|
| + MediaSinksObserver(MediaRouter* router,
|
| + const MediaSource& source,
|
| + const GURL& origin);
|
| virtual ~MediaSinksObserver();
|
|
|
| // Registers with MediaRouter to start observing. Must be called before the
|
| @@ -33,20 +36,33 @@ class MediaSinksObserver {
|
| // initialized. This method is no-op if the observer is already initialized.
|
| bool Init();
|
|
|
| - // This function is invoked when the list of sinks compatible
|
| - // with |source_| has been updated.
|
| + // This function is invoked when the list of sinks compatible with |source_|
|
| + // has been updated. The result also contains the list of valid origins.
|
| + // If |origins| is empty or contains |origin_|, then |OnSinksReceived(sinks)|
|
| + // will be invoked with |sinks|. Otherwise, it will be invoked with an empty
|
| + // list.
|
| + void OnSinksUpdated(const std::vector<MediaSink>& sinks,
|
| + const std::vector<GURL>& origins);
|
| +
|
| + const MediaSource& source() const { return source_; }
|
| +
|
| + protected:
|
| + // This function is invoked from |OnSinksUpdated(sinks, origins)|.
|
| // Implementations may not perform operations that modify the Media Router's
|
| // observer list. In particular, invoking this observer's destructor within
|
| // OnSinksReceived will result in undefined behavior.
|
| - virtual void OnSinksReceived(const std::vector<MediaSink>& sinks) {}
|
| -
|
| - const MediaSource& source() const { return source_; }
|
| + virtual void OnSinksReceived(const std::vector<MediaSink>& sinks) = 0;
|
|
|
| private:
|
| const MediaSource source_;
|
| - MediaRouter* router_;
|
| + const GURL origin_;
|
| + MediaRouter* const router_;
|
| bool initialized_;
|
|
|
| +#if DCHECK_IS_ON()
|
| + bool in_on_sinks_updated_ = false;
|
| +#endif
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(MediaSinksObserver);
|
| };
|
|
|
|
|