1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_
10 #include "base/macros.h"
11 #include "chrome/browser/media/router/media_sink.h"
12 #include "chrome/browser/media/router/media_source.h"
14 namespace media_router
{
18 // Base class for observing when the collection of sinks compatible with
19 // a MediaSource has been updated.
20 // A MediaSinksObserver implementation can be registered to MediaRouter to
21 // receive results. It can then interpret / process the results accordingly.
22 class MediaSinksObserver
{
24 // Constructs an observer that will observe for sinks compatible
26 MediaSinksObserver(MediaRouter
* router
, const MediaSource
& source
);
27 virtual ~MediaSinksObserver();
29 // This function is invoked when the list of sinks compatible
30 // with |source_| has been updated.
31 // Implementations may not perform operations that modify the Media Router's
32 // observer list. In particular, invoking this observer's destructor within
33 // OnSinksReceived will result in undefined behavior.
34 virtual void OnSinksReceived(const std::vector
<MediaSink
>& sinks
) {}
36 const MediaSource
& source() const { return source_
; }
39 const MediaSource source_
;
42 DISALLOW_COPY_AND_ASSIGN(MediaSinksObserver
);
45 } // namespace media_router
47 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_