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 "content/renderer/media/crypto/proxy_media_keys.h" | 5 #include "content/renderer/media/crypto/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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scoped_ptr<media::CdmPromise> promise = TakePromise(session_id); | 154 scoped_ptr<media::CdmPromise> promise = TakePromise(session_id); |
155 if (promise) { | 155 if (promise) { |
156 media::NewSessionCdmPromise* session_promise( | 156 media::NewSessionCdmPromise* session_promise( |
157 static_cast<media::NewSessionCdmPromise*>(promise.get())); | 157 static_cast<media::NewSessionCdmPromise*>(promise.get())); |
158 session_promise->resolve(web_session_id); | 158 session_promise->resolve(web_session_id); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 void ProxyMediaKeys::OnSessionMessage(uint32 session_id, | 162 void ProxyMediaKeys::OnSessionMessage(uint32 session_id, |
163 const std::vector<uint8>& message, | 163 const std::vector<uint8>& message, |
164 const GURL& destination_url) { | 164 const GURL& legacy_destination_url) { |
165 // TODO(jrummell): Once |message_type| is passed, use it rather than | 165 // TODO(jrummell): Once |message_type| is passed, use it rather than |
166 // guessing from the URL. | 166 // guessing from the URL. |
167 media::MediaKeys::MessageType message_type = | 167 media::MediaKeys::MessageType message_type = |
168 destination_url.is_empty() ? media::MediaKeys::LICENSE_REQUEST | 168 legacy_destination_url.is_empty() ? media::MediaKeys::LICENSE_REQUEST |
169 : media::MediaKeys::LICENSE_RENEWAL; | 169 : media::MediaKeys::LICENSE_RENEWAL; |
170 session_message_cb_.Run(LookupWebSessionId(session_id), message_type, | 170 session_message_cb_.Run(LookupWebSessionId(session_id), message_type, message, |
171 message); | 171 legacy_destination_url); |
172 } | 172 } |
173 | 173 |
174 void ProxyMediaKeys::OnSessionReady(uint32 session_id) { | 174 void ProxyMediaKeys::OnSessionReady(uint32 session_id) { |
175 scoped_ptr<media::CdmPromise> promise = TakePromise(session_id); | 175 scoped_ptr<media::CdmPromise> promise = TakePromise(session_id); |
176 if (promise) { | 176 if (promise) { |
177 media::SimpleCdmPromise* simple_promise( | 177 media::SimpleCdmPromise* simple_promise( |
178 static_cast<media::SimpleCdmPromise*>(promise.get())); | 178 static_cast<media::SimpleCdmPromise*>(promise.get())); |
179 simple_promise->resolve(); | 179 simple_promise->resolve(); |
180 } | 180 } |
181 } | 181 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) { | 288 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) { |
289 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id); | 289 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id); |
290 // May not be a promise associated with this session for asynchronous events. | 290 // May not be a promise associated with this session for asynchronous events. |
291 if (it == session_id_to_promise_map_.end()) | 291 if (it == session_id_to_promise_map_.end()) |
292 return scoped_ptr<media::CdmPromise>(); | 292 return scoped_ptr<media::CdmPromise>(); |
293 return session_id_to_promise_map_.take_and_erase(it); | 293 return session_id_to_promise_map_.take_and_erase(it); |
294 } | 294 } |
295 | 295 |
296 } // namespace content | 296 } // namespace content |
OLD | NEW |