OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BASE_BROWSER_CDM_H_ | 5 #ifndef MEDIA_BASE_BROWSER_CDM_H_ |
6 #define MEDIA_BASE_BROWSER_CDM_H_ | 6 #define MEDIA_BASE_BROWSER_CDM_H_ |
7 | 7 |
8 #include "media/base/media_export.h" | 8 #include "media/base/media_export.h" |
9 #include "media/base/media_keys.h" | 9 #include "media/base/media_keys.h" |
10 #include "media/base/player_tracker.h" | 10 #include "media/base/player_tracker.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // Interface for browser side CDMs. | 14 // Interface for browser side CDMs. |
15 class MEDIA_EXPORT BrowserCdm : public PlayerTracker { | 15 class MEDIA_EXPORT BrowserCdm : public MediaKeys, public PlayerTracker { |
16 public: | 16 public: |
17 // TODO(jrummell): Update this to actually derive from MediaKeys | |
18 // (Use web_session_id rather than session_id). | |
19 typedef base::Callback< | |
20 void(uint32 session_id, const std::string& web_session_id)> | |
21 SessionCreatedCB; | |
22 | |
23 typedef base::Callback<void(uint32 session_id, | |
24 const std::vector<uint8>& message, | |
25 const GURL& destination_url)> SessionMessageCB; | |
26 | |
27 typedef base::Callback<void(uint32 session_id)> SessionReadyCB; | |
28 | |
29 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; | |
30 | |
31 typedef base::Callback<void(uint32 session_id, | |
32 media::MediaKeys::KeyError error_code, | |
33 uint32 system_code)> SessionErrorCB; | |
34 | |
35 ~BrowserCdm() override; | 17 ~BrowserCdm() override; |
36 | 18 |
37 // MediaKeys-like implementation. | |
38 virtual bool CreateSession(uint32 session_id, | |
39 const std::string& content_type, | |
40 const uint8* init_data, | |
41 int init_data_length) = 0; | |
42 virtual void LoadSession(uint32 session_id, | |
43 const std::string& web_session_id) = 0; | |
44 virtual void UpdateSession(uint32 session_id, | |
45 const uint8* response, | |
46 int response_length) = 0; | |
47 virtual void ReleaseSession(uint32 session_id) = 0; | |
48 | |
49 // PlayerTracker implementation. | |
50 int RegisterPlayer(const base::Closure& new_key_cb, | |
51 const base::Closure& cdm_unset_cb) override = 0; | |
52 void UnregisterPlayer(int registration_id) override = 0; | |
53 | |
54 protected: | 19 protected: |
55 BrowserCdm(); | 20 BrowserCdm(); |
56 | 21 |
57 private: | 22 private: |
58 DISALLOW_COPY_AND_ASSIGN(BrowserCdm); | 23 DISALLOW_COPY_AND_ASSIGN(BrowserCdm); |
59 }; | 24 }; |
60 | 25 |
61 } // namespace media | 26 } // namespace media |
62 | 27 |
63 #endif // MEDIA_BASE_BROWSER_CDM_H_ | 28 #endif // MEDIA_BASE_BROWSER_CDM_H_ |
OLD | NEW |