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..6e33757c09123444dc369ff72a6a296484e78458 |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_sinks_observer.h |
| @@ -0,0 +1,45 @@ |
| +// 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 "chrome/browser/media/router/media_sink.h" |
| +#include "chrome/browser/media/router/media_source.h" |
| + |
| +namespace media_router { |
| + |
| +struct SinksQueryResult { |
|
mark a. foltz
2015/03/27 21:21:59
Should this be a using declaration for std::vector
imcheng
2015/03/30 22:49:10
The latter.
|
| + SinksQueryResult(); |
| + ~SinksQueryResult(); |
| + |
| + std::vector<MediaSink> sinks; |
| +}; |
| + |
| +// Interface for observing when the collection of sinks compatible with |
|
mark a. foltz
2015/03/27 21:21:59
Not an interface.
imcheng
2015/03/30 22:49:10
Ok, let's call it base class and provide a no-op i
|
| +// 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|. |
| + explicit MediaSinksObserver(const MediaSource& source) : source_(source) {} |
| + virtual ~MediaSinksObserver() {} |
| + |
| + // This function is invoked when the list of sinks compatible |
| + // with |source_| has been updated. |
| + virtual void OnSinksReceived(const SinksQueryResult& result) = 0; |
|
mark a. foltz
2015/03/27 21:21:59
The API is a little limiting in that there must be
imcheng
2015/03/30 22:49:10
Agreed. WebContentsObserver follow a similar model
|
| + |
| + const MediaSource& source() const { return source_; } |
| + |
| + private: |
| + MediaSource source_; |
| +}; |
| + |
| +} // namespace media_router |
| + |
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |