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

Unified Diff: chrome/browser/media/router/media_sinks_observer.h

Issue 1784533004: [Media Router] Add origins to sink query results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/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..72bdf72146e7e2a8ee73e7736b3d94d33763150b 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 {
@@ -25,7 +26,9 @@ class MediaSinksObserver {
public:
// Constructs an observer that will observe for sinks compatible
// with |source|.
mark a. foltz 2016/03/11 01:20:23 Document meaning of |origin|.
imcheng 2016/03/14 21:30:20 Done.
- 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,18 +36,26 @@ 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.
- // 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) {}
+ // 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_; }
private:
+ // 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.
mark a. foltz 2016/03/11 01:20:23 This seems like common sense, but maybe it could b
imcheng 2016/03/14 21:30:20 Done.
+ virtual void OnSinksReceived(const std::vector<MediaSink>& sinks) = 0;
mark a. foltz 2016/03/11 01:20:23 Usually virtual methods that are to be implemented
imcheng 2016/03/14 21:30:20 Done. Moved back to public
+
const MediaSource source_;
- MediaRouter* router_;
+ const GURL origin_;
+ MediaRouter* const router_;
bool initialized_;
DISALLOW_COPY_AND_ASSIGN(MediaSinksObserver);

Powered by Google App Engine
This is Rietveld 408576698