Chromium Code Reviews| Index: media/remoting/remoting_cdm_controller.h |
| diff --git a/media/remoting/remoting_cdm_controller.h b/media/remoting/remoting_cdm_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..809cdf10ec6cb1bfb79c4cbbcc6806631c44b65b |
| --- /dev/null |
| +++ b/media/remoting/remoting_cdm_controller.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2016 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 MEDIA_REMOTING_REMOTING_CDM_CONTROLLER_H_ |
| +#define MEDIA_REMOTING_REMOTING_CDM_CONTROLLER_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "media/remoting/remoting_source_impl.h" |
| + |
| +namespace base { |
| +class ThreadChecker; |
| +} |
|
xhwang
2016/11/01 08:21:29
This won't work and you are actually getting the d
xjz
2016/11/01 21:55:53
Done.
|
| + |
| +namespace media { |
| + |
| +// This class controlls whether to start a remoting session to create CDM. |
| +// The |remoting_source_| will be passed to the RemotingRendererController when |
| +// the CDM is attached to a media element. |
| +class RemotingCdmController final : public RemotingSourceImpl::Client { |
| + public: |
| + explicit RemotingCdmController( |
| + scoped_refptr<RemotingSourceImpl> remoting_source); |
| + ~RemotingCdmController(); |
| + |
| + // RemotingSourceImpl::Client implementations. |
| + void OnStarted(bool success) override; |
| + void OnSessionStateChanged() override; |
| + |
| + // Query whether to create a Media Remoting CDM. |cb| could be run |
| + // synchronously or asynchronously, depending on whether the required |
| + // information is available now or later. |
| + using CdmCheckCallback = base::Callback<void(bool is_remoting)>; |
|
xhwang
2016/11/01 08:21:29
nit: Returns whether we should create remoting CDM
xjz
2016/11/01 21:55:53
Done.
|
| + void ShouldCreateRemotingCdm(const CdmCheckCallback& cb); |
| + |
| + RemotingSourceImpl* remoting_source() const { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + return remoting_source_.get(); |
|
xhwang
2016/11/01 08:21:29
See comment above... why are we passing raw pointe
xjz
2016/11/01 21:55:53
See reply above. :)
|
| + } |
| + |
| + private: |
| + const scoped_refptr<RemotingSourceImpl> remoting_source_; |
| + |
| + // This callback is run once to report whether to create remoting CDM. |
| + CdmCheckCallback cdm_check_cb_; |
| + |
| + // Indicates if remoting is started. |
|
xhwang
2016/11/01 08:21:29
what does "remoting is started" means exactly? e.g
xjz
2016/11/01 21:55:53
This variable indicates if in remoting. i.e., remo
|
| + bool is_remoting_ = false; |
| + |
| + // This is used to check all the methods are called on the current thread in |
| + // debug builds. |
|
xhwang
2016/11/01 08:21:28
nit: This comment seems unnecessary :) But it's up
xjz
2016/11/01 21:55:53
Done.
|
| + base::ThreadChecker thread_checker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RemotingCdmController); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_REMOTING_REMOTING_CDM_CONTROLLER_H_ |