| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MEDIA_REMOTING_REMOTING_SINK_OBSERVER_H_ | 5 #ifndef MEDIA_REMOTING_SINK_AVAILABILITY_OBSERVER_H_ |
| 6 #define MEDIA_REMOTING_REMOTING_SINK_OBSERVER_H_ | 6 #define MEDIA_REMOTING_SINK_AVAILABILITY_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "media/mojo/interfaces/remoting.mojom.h" | 8 #include "media/mojo/interfaces/remoting.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" | 9 #include "mojo/public/cpp/bindings/binding.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 namespace remoting { |
| 12 | 13 |
| 13 // This calss is a pure observer of remoting sink availability to indicate | 14 // Implements the RemotingSource interface for the sole purpose of monitoring |
| 14 // whether a remoting session can be started. | 15 // sink availability status. |
| 15 class RemotingSinkObserver final : public mojom::RemotingSource { | 16 class SinkAvailabilityObserver final : public mojom::RemotingSource { |
| 16 public: | 17 public: |
| 17 RemotingSinkObserver(mojom::RemotingSourceRequest source_request, | 18 SinkAvailabilityObserver(mojom::RemotingSourceRequest source_request, |
| 18 mojom::RemoterPtr remoter); | 19 mojom::RemoterPtr remoter); |
| 19 ~RemotingSinkObserver() override; | 20 ~SinkAvailabilityObserver() override; |
| 20 | 21 |
| 21 mojom::RemotingSinkCapabilities sink_capabilities() const { | 22 mojom::RemotingSinkCapabilities sink_capabilities() const { |
| 22 return sink_capabilities_; | 23 return sink_capabilities_; |
| 23 } | 24 } |
| 24 | 25 |
| 25 bool is_remote_decryption_available() const { | 26 bool is_remote_decryption_available() const { |
| 26 return sink_capabilities_ == | 27 return sink_capabilities_ == |
| 27 mojom::RemotingSinkCapabilities::CONTENT_DECRYPTION_AND_RENDERING; | 28 mojom::RemotingSinkCapabilities::CONTENT_DECRYPTION_AND_RENDERING; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // RemotingSource implementations. | 31 // RemotingSource implementations. |
| 31 void OnSinkAvailable(mojom::RemotingSinkCapabilities capabilities) override; | 32 void OnSinkAvailable(mojom::RemotingSinkCapabilities capabilities) override; |
| 32 void OnSinkGone() override; | 33 void OnSinkGone() override; |
| 33 void OnStarted() override {} | 34 void OnStarted() override {} |
| 34 void OnStartFailed(mojom::RemotingStartFailReason reason) override {} | 35 void OnStartFailed(mojom::RemotingStartFailReason reason) override {} |
| 35 void OnMessageFromSink(const std::vector<uint8_t>& message) override {} | 36 void OnMessageFromSink(const std::vector<uint8_t>& message) override {} |
| 36 void OnStopped(mojom::RemotingStopReason reason) override {} | 37 void OnStopped(mojom::RemotingStopReason reason) override {} |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 const mojo::Binding<mojom::RemotingSource> binding_; | 40 const mojo::Binding<mojom::RemotingSource> binding_; |
| 40 const mojom::RemoterPtr remoter_; | 41 const mojom::RemoterPtr remoter_; |
| 41 | 42 |
| 42 // When the sink is available, this describes its capabilities. When not | 43 // When the sink is available, this describes its capabilities. When not |
| 43 // available, this is always NONE. Updated by OnSinkAvailable/Gone(). | 44 // available, this is always NONE. Updated by OnSinkAvailable/Gone(). |
| 44 mojom::RemotingSinkCapabilities sink_capabilities_ = | 45 mojom::RemotingSinkCapabilities sink_capabilities_ = |
| 45 mojom::RemotingSinkCapabilities::NONE; | 46 mojom::RemotingSinkCapabilities::NONE; |
| 46 | 47 |
| 47 DISALLOW_COPY_AND_ASSIGN(RemotingSinkObserver); | 48 DISALLOW_COPY_AND_ASSIGN(SinkAvailabilityObserver); |
| 48 }; | 49 }; |
| 49 | 50 |
| 51 } // namespace remoting |
| 50 } // namespace media | 52 } // namespace media |
| 51 | 53 |
| 52 #endif // MEDIA_REMOTING_REMOTING_SINK_OBSERVER_H_ | 54 #endif // MEDIA_REMOTING_SINK_AVAILABILITY_OBSERVER_H_ |
| OLD | NEW |