Chromium Code Reviews| 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_CDM_CONTROLLER_H_ | |
| 6 #define MEDIA_REMOTING_REMOTING_CDM_CONTROLLER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "media/remoting/remoting_source_impl.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class ThreadChecker; | |
| 14 } | |
|
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.
| |
| 15 | |
| 16 namespace media { | |
| 17 | |
| 18 // This class controlls whether to start a remoting session to create CDM. | |
| 19 // The |remoting_source_| will be passed to the RemotingRendererController when | |
| 20 // the CDM is attached to a media element. | |
| 21 class RemotingCdmController final : public RemotingSourceImpl::Client { | |
| 22 public: | |
| 23 explicit RemotingCdmController( | |
| 24 scoped_refptr<RemotingSourceImpl> remoting_source); | |
| 25 ~RemotingCdmController(); | |
| 26 | |
| 27 // RemotingSourceImpl::Client implementations. | |
| 28 void OnStarted(bool success) override; | |
| 29 void OnSessionStateChanged() override; | |
| 30 | |
| 31 // Query whether to create a Media Remoting CDM. |cb| could be run | |
| 32 // synchronously or asynchronously, depending on whether the required | |
| 33 // information is available now or later. | |
| 34 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.
| |
| 35 void ShouldCreateRemotingCdm(const CdmCheckCallback& cb); | |
| 36 | |
| 37 RemotingSourceImpl* remoting_source() const { | |
| 38 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 39 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. :)
| |
| 40 } | |
| 41 | |
| 42 private: | |
| 43 const scoped_refptr<RemotingSourceImpl> remoting_source_; | |
| 44 | |
| 45 // This callback is run once to report whether to create remoting CDM. | |
| 46 CdmCheckCallback cdm_check_cb_; | |
| 47 | |
| 48 // 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
| |
| 49 bool is_remoting_ = false; | |
| 50 | |
| 51 // This is used to check all the methods are called on the current thread in | |
| 52 // 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.
| |
| 53 base::ThreadChecker thread_checker_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(RemotingCdmController); | |
| 56 }; | |
| 57 | |
| 58 } // namespace media | |
| 59 | |
| 60 #endif // MEDIA_REMOTING_REMOTING_CDM_CONTROLLER_H_ | |
| OLD | NEW |