OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/proxy_media_keys.h" | 5 #include "content/renderer/media/android/proxy_media_keys.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 const GURL& frame_url) { | 38 const GURL& frame_url) { |
39 #if defined(ENABLE_PEPPER_CDMS) | 39 #if defined(ENABLE_PEPPER_CDMS) |
40 NOTIMPLEMENTED(); | 40 NOTIMPLEMENTED(); |
41 #elif defined(OS_ANDROID) | 41 #elif defined(OS_ANDROID) |
42 std::vector<uint8> uuid = GetUUID(key_system); | 42 std::vector<uint8> uuid = GetUUID(key_system); |
43 DCHECK(!uuid.empty()); | 43 DCHECK(!uuid.empty()); |
44 manager_->InitializeCDM(media_keys_id_, this, uuid, frame_url); | 44 manager_->InitializeCDM(media_keys_id_, this, uuid, frame_url); |
45 #endif | 45 #endif |
46 } | 46 } |
47 | 47 |
48 bool ProxyMediaKeys::CreateSession(uint32 reference_id, | 48 bool ProxyMediaKeys::CreateSession(uint32 session_id, |
49 const std::string& type, | 49 const std::string& type, |
50 const uint8* init_data, | 50 const uint8* init_data, |
51 int init_data_length) { | 51 int init_data_length) { |
52 manager_->GenerateKeyRequest( | 52 manager_->GenerateKeyRequest( |
53 media_keys_id_, | 53 media_keys_id_, |
54 reference_id, | 54 session_id, |
55 type, | 55 type, |
56 std::vector<uint8>(init_data, init_data + init_data_length)); | 56 std::vector<uint8>(init_data, init_data + init_data_length)); |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 void ProxyMediaKeys::UpdateSession(uint32 reference_id, | 60 void ProxyMediaKeys::UpdateSession(uint32 session_id, |
61 const uint8* response, | 61 const uint8* response, |
62 int response_length) { | 62 int response_length) { |
63 manager_->AddKey(media_keys_id_, | 63 manager_->AddKey(media_keys_id_, |
64 reference_id, | 64 session_id, |
65 std::vector<uint8>(response, response + response_length), | 65 std::vector<uint8>(response, response + response_length), |
66 std::vector<uint8>()); | 66 std::vector<uint8>()); |
67 } | 67 } |
68 | 68 |
69 void ProxyMediaKeys::ReleaseSession(uint32 reference_id) { | 69 void ProxyMediaKeys::ReleaseSession(uint32 session_id) { |
70 manager_->CancelKeyRequest(media_keys_id_, reference_id); | 70 manager_->CancelKeyRequest(media_keys_id_, session_id); |
71 } | 71 } |
72 | 72 |
73 void ProxyMediaKeys::OnSessionCreated(uint32 reference_id, | 73 void ProxyMediaKeys::OnSessionCreated(uint32 session_id, |
74 const std::string& session_id) { | 74 const std::string& web_session_id) { |
75 session_created_cb_.Run(reference_id, session_id); | 75 session_created_cb_.Run(session_id, web_session_id); |
76 } | 76 } |
77 | 77 |
78 void ProxyMediaKeys::OnSessionMessage(uint32 reference_id, | 78 void ProxyMediaKeys::OnSessionMessage(uint32 session_id, |
79 const std::vector<uint8>& message, | 79 const std::vector<uint8>& message, |
80 const std::string& destination_url) { | 80 const std::string& destination_url) { |
81 session_message_cb_.Run(reference_id, message, destination_url); | 81 session_message_cb_.Run(session_id, message, destination_url); |
82 } | 82 } |
83 | 83 |
84 void ProxyMediaKeys::OnSessionReady(uint32 reference_id) { | 84 void ProxyMediaKeys::OnSessionReady(uint32 session_id) { |
85 session_ready_cb_.Run(reference_id); | 85 session_ready_cb_.Run(session_id); |
86 } | 86 } |
87 | 87 |
88 void ProxyMediaKeys::OnSessionClosed(uint32 reference_id) { | 88 void ProxyMediaKeys::OnSessionClosed(uint32 session_id) { |
89 session_closed_cb_.Run(reference_id); | 89 session_closed_cb_.Run(session_id); |
90 } | 90 } |
91 | 91 |
92 void ProxyMediaKeys::OnSessionError(uint32 reference_id, | 92 void ProxyMediaKeys::OnSessionError(uint32 session_id, |
93 media::MediaKeys::KeyError error_code, | 93 media::MediaKeys::KeyError error_code, |
94 int system_code) { | 94 int system_code) { |
95 session_error_cb_.Run(reference_id, error_code, system_code); | 95 session_error_cb_.Run(session_id, error_code, system_code); |
96 } | 96 } |
97 | 97 |
98 } // namespace content | 98 } // namespace content |
OLD | NEW |