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