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_PRESENTATION_MEDIA_SINKS_OBSERVER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_MEDIA_SINKS_OBSERVER_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/media/router/media_sinks_observer.h"
11 #include "content/public/browser/presentation_service_delegate.h"
14 class PresentationScreenAvailabilityListener
;
17 namespace media_router
{
22 // Receives SinkQueryResults for |source| from |router| and propagates results
23 // to |listener|. |listener| is notified only when availability status has
24 // changed, i.e. sinks have become available or sinks are no longer available.
25 class PresentationMediaSinksObserver
: public MediaSinksObserver
{
27 // |router|: Media router that publishes sink query results.
28 // |listener|: Notified when sinks availability changes.
29 // |source|: Filters available sink.
30 // Does not take ownership of |listener| or |router|.
31 PresentationMediaSinksObserver(
33 content::PresentationScreenAvailabilityListener
* listener
,
34 const MediaSource
& source
);
35 ~PresentationMediaSinksObserver() override
;
37 // MediaSinksObserver implementation.
38 void OnSinksReceived(const std::vector
<MediaSink
>& result
) override
;
40 content::PresentationScreenAvailabilityListener
* listener() const {
45 enum Availability
{ UNKNOWN
, AVAILABLE
, UNAVAILABLE
};
47 content::PresentationScreenAvailabilityListener
* listener_
;
48 Availability previous_availablity_
;
50 DISALLOW_COPY_AND_ASSIGN(PresentationMediaSinksObserver
);
53 } // namespace media_router
55 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_MEDIA_SINKS_OBSERVER_H_