| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // generated. | 21 // generated. |
| 22 // This class is not thread safe. All methods must be called from the IO thread. | 22 // This class is not thread safe. All methods must be called from the IO thread. |
| 23 class MediaSinkService { | 23 class MediaSinkService { |
| 24 public: | 24 public: |
| 25 // Callback to be invoked when this class finishes sink discovering. | 25 // Callback to be invoked when this class finishes sink discovering. |
| 26 // Arg 0: Sinks discovered and resolved by the service. | 26 // Arg 0: Sinks discovered and resolved by the service. |
| 27 using OnSinksDiscoveredCallback = | 27 using OnSinksDiscoveredCallback = |
| 28 base::Callback<void(const std::vector<MediaSink>&)>; | 28 base::Callback<void(const std::vector<MediaSink>&)>; |
| 29 | 29 |
| 30 explicit MediaSinkService( | 30 explicit MediaSinkService( |
| 31 const OnSinksDiscoveredCallback& sinks_discovered_callback); | 31 const OnSinksDiscoveredCallback& sink_discovery_callback); |
| 32 | 32 |
| 33 virtual ~MediaSinkService(); | 33 virtual ~MediaSinkService(); |
| 34 | 34 |
| 35 // Starts sink discovery. No-ops if already started. | 35 // Starts sink discovery. No-ops if already started. |
| 36 // Sinks discovered and resolved are continuously passed to | 36 // Sinks discovered and resolved are continuously passed to |
| 37 // |callback|. | 37 // |callback|. |
| 38 virtual void Start() = 0; | 38 virtual void Start() = 0; |
| 39 | 39 |
| 40 // Adds a sink query to observe for MediaSink updates. | 40 // Adds a sink query to observe for MediaSink updates. |
| 41 // Multiple observers can be added for a given MediaSource. | 41 // Multiple observers can be added for a given MediaSource. |
| 42 // Start() must be called first. This class does not take | 42 // Start() must be called first. This class does not take |
| 43 // ownership of |observer|. | 43 // ownership of |observer|. |
| 44 virtual void AddSinkQuery(MediaSinksObserver* observer) = 0; | 44 virtual void AddSinkQuery(MediaSinksObserver* observer) = 0; |
| 45 | 45 |
| 46 // Removes a sink query and stops observing MediaSink updates. No-op if | 46 // Removes a sink query and stops observing MediaSink updates. No-op if |
| 47 // |observer| is not registered with this class. | 47 // |observer| is not registered with this class. |
| 48 virtual void RemoveSinkQuery(MediaSinksObserver* observer) = 0; | 48 virtual void RemoveSinkQuery(MediaSinksObserver* observer) = 0; |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 OnSinksDiscoveredCallback sinks_discovered_callback_; | 51 OnSinksDiscoveredCallback sink_discovery_callback_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(MediaSinkService); | 53 DISALLOW_COPY_AND_ASSIGN(MediaSinkService); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace media_router | 56 } // namespace media_router |
| 57 | 57 |
| 58 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ | 58 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ |
| OLD | NEW |