Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / media / router / presentation_media_sinks_observer.cc
blob809eddde30e78373891078ca3dc1ee6c27106898
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 #include "chrome/browser/media/router/presentation_media_sinks_observer.h"
7 #include "chrome/browser/media/router/media_router.h"
8 #include "chrome/browser/media/router/media_source.h"
9 #include "content/public/browser/presentation_screen_availability_listener.h"
11 namespace media_router {
13 PresentationMediaSinksObserver::PresentationMediaSinksObserver(
14 MediaRouter* router,
15 content::PresentationScreenAvailabilityListener* listener,
16 const MediaSource& source)
17 : MediaSinksObserver(router, source),
18 listener_(listener),
19 previous_availablity_(UNKNOWN) {
20 DCHECK(router);
21 DCHECK(listener_);
22 DCHECK(!source.Empty());
25 PresentationMediaSinksObserver::~PresentationMediaSinksObserver() {
28 void PresentationMediaSinksObserver::OnSinksReceived(
29 const std::vector<MediaSink>& result) {
30 Availability current_availability = result.empty() ? UNAVAILABLE : AVAILABLE;
32 DVLOG(1) << "PresentationMediaSinksObserver::OnSinksReceived: "
33 << source().ToString() << " "
34 << (result.empty() ? "unavailable" : "available");
36 // Don't send if new result is same as previous.
37 if (previous_availablity_ != current_availability)
38 listener_->OnScreenAvailabilityChanged(current_availability == AVAILABLE);
40 previous_availablity_ = current_availability;
43 } // namespace media_router