Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: media/remoting/remoting_cdm_controller.h

Issue 2457563002: Media Remoting: Add remoting control logic for encrypted contents. (Closed)
Patch Set: Rebase Only. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
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)>;
35 void ShouldCreateRemotingCdm(const CdmCheckCallback& cb);
36
37 scoped_refptr<RemotingSourceImpl> remoting_source() {
xjz 2016/10/27 22:45:58 Done.
38 DCHECK(thread_checker_.CalledOnValidThread());
39 return remoting_source_;
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.
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.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698