Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0b7bb5eb792dcbb17d050ad8784aca9f8241871e |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_sinks_observer.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |
| +#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "chrome/browser/media/router/media_sink.h" |
| +#include "chrome/browser/media/router/media_source.h" |
| + |
| +namespace media_router { |
| + |
| +class MediaRouter; |
| + |
| +// Base class for observing when the collection of sinks compatible with |
| +// a MediaSource has been updated. |
| +// A MediaSinksObserver implementation can be registered to MediaRouter to |
| +// receive results. It can then interpret / process the results accordingly. |
| +class MediaSinksObserver { |
| + public: |
| + // Constructs an observer that will observe for sinks compatible |
| + // with |source|. |
| + MediaSinksObserver(MediaRouter* router, const MediaSource& source); |
|
xhwang
2015/04/08 17:46:25
This is much cleaner. Thanks!
imcheng
2015/04/08 19:21:31
Acknowledged.
|
| + virtual ~MediaSinksObserver(); |
| + |
| + // This function is invoked when the list of sinks compatible |
| + // with |source_| has been updated. |
| + virtual void OnSinksReceived(const std::vector<MediaSink>& sinks) {} |
| + |
| + const MediaSource& source() const { return source_; } |
| + |
| + private: |
| + const MediaSource source_; |
| + MediaRouter* router_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaSinksObserver); |
| +}; |
| + |
| +} // namespace media_router |
| + |
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |