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 #include "chromecast/media/cdm/browser_cdm_cast.h" | 5 #include "chromecast/media/cdm/browser_cdm_cast.h" |
6 | 6 |
7 #include "media/base/cdm_key_information.h" | 7 #include "media/base/cdm_key_information.h" |
8 | 8 |
9 namespace chromecast { | 9 namespace chromecast { |
10 namespace media { | 10 namespace media { |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 int BrowserCdmCast::RegisterPlayer(const base::Closure& new_key_cb, | 32 int BrowserCdmCast::RegisterPlayer(const base::Closure& new_key_cb, |
33 const base::Closure& cdm_unset_cb) { | 33 const base::Closure& cdm_unset_cb) { |
34 return player_tracker_.RegisterPlayer(new_key_cb, cdm_unset_cb); | 34 return player_tracker_.RegisterPlayer(new_key_cb, cdm_unset_cb); |
35 } | 35 } |
36 | 36 |
37 void BrowserCdmCast::UnregisterPlayer(int registration_id) { | 37 void BrowserCdmCast::UnregisterPlayer(int registration_id) { |
38 player_tracker_.UnregisterPlayer(registration_id); | 38 player_tracker_.UnregisterPlayer(registration_id); |
39 } | 39 } |
40 | 40 |
41 void BrowserCdmCast::OnSessionMessage(const std::string& web_session_id, | 41 void BrowserCdmCast::OnSessionMessage(const std::string& session_id, |
42 const std::vector<uint8>& message, | 42 const std::vector<uint8>& message, |
43 const GURL& destination_url) { | 43 const GURL& destination_url) { |
44 // Note: Message type is not supported in Chromecast. Do our best guess here. | 44 // Note: Message type is not supported in Chromecast. Do our best guess here. |
45 ::media::MediaKeys::MessageType message_type = | 45 ::media::MediaKeys::MessageType message_type = |
46 destination_url.is_empty() ? ::media::MediaKeys::LICENSE_REQUEST | 46 destination_url.is_empty() ? ::media::MediaKeys::LICENSE_REQUEST |
47 : ::media::MediaKeys::LICENSE_RENEWAL; | 47 : ::media::MediaKeys::LICENSE_RENEWAL; |
48 session_message_cb_.Run(web_session_id, | 48 session_message_cb_.Run(session_id, |
49 message_type, | 49 message_type, |
50 message, | 50 message, |
51 destination_url); | 51 destination_url); |
52 } | 52 } |
53 | 53 |
54 void BrowserCdmCast::OnSessionClosed(const std::string& web_session_id) { | 54 void BrowserCdmCast::OnSessionClosed(const std::string& session_id) { |
55 session_closed_cb_.Run(web_session_id); | 55 session_closed_cb_.Run(session_id); |
56 } | 56 } |
57 | 57 |
58 void BrowserCdmCast::OnSessionKeysChange( | 58 void BrowserCdmCast::OnSessionKeysChange( |
59 const std::string& web_session_id, | 59 const std::string& session_id, |
60 const ::media::KeyIdAndKeyPairs& keys) { | 60 const ::media::KeyIdAndKeyPairs& keys) { |
61 ::media::CdmKeysInfo cdm_keys_info; | 61 ::media::CdmKeysInfo cdm_keys_info; |
62 for (const std::pair<std::string, std::string>& key : keys) { | 62 for (const std::pair<std::string, std::string>& key : keys) { |
63 scoped_ptr< ::media::CdmKeyInformation> cdm_key_information( | 63 scoped_ptr< ::media::CdmKeyInformation> cdm_key_information( |
64 new ::media::CdmKeyInformation()); | 64 new ::media::CdmKeyInformation()); |
65 cdm_key_information->key_id.assign(key.first.begin(), key.first.end()); | 65 cdm_key_information->key_id.assign(key.first.begin(), key.first.end()); |
66 cdm_keys_info.push_back(cdm_key_information.release()); | 66 cdm_keys_info.push_back(cdm_key_information.release()); |
67 } | 67 } |
68 session_keys_change_cb_.Run(web_session_id, true, cdm_keys_info.Pass()); | 68 session_keys_change_cb_.Run(session_id, true, cdm_keys_info.Pass()); |
69 | 69 |
70 // Notify listeners of a new key. | 70 // Notify listeners of a new key. |
71 player_tracker_.NotifyNewKey(); | 71 player_tracker_.NotifyNewKey(); |
72 } | 72 } |
73 | 73 |
74 } // namespace media | 74 } // namespace media |
75 } // namespace chromecast | 75 } // namespace chromecast |
OLD | NEW |