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