| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 MediaKeys::~MediaKeys() { | 153 MediaKeys::~MediaKeys() { |
| 154 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; | 154 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; |
| 155 InstanceCounters::decrementCounter(InstanceCounters::MediaKeysCounter); | 155 InstanceCounters::decrementCounter(InstanceCounters::MediaKeysCounter); |
| 156 } | 156 } |
| 157 | 157 |
| 158 MediaKeySession* MediaKeys::createSession(ScriptState* scriptState, | 158 MediaKeySession* MediaKeys::createSession(ScriptState* scriptState, |
| 159 const String& sessionTypeString, | 159 const String& sessionTypeString, |
| 160 ExceptionState& exceptionState) { | 160 ExceptionState& exceptionState) { |
| 161 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ") " | 161 DVLOG(MEDIA_KEYS_LOG_LEVEL) |
| 162 << sessionTypeString; | 162 << __func__ << "(" << this << ") " << sessionTypeString; |
| 163 | 163 |
| 164 // From http://w3c.github.io/encrypted-media/#createSession | 164 // From http://w3c.github.io/encrypted-media/#createSession |
| 165 | 165 |
| 166 // When this method is invoked, the user agent must run the following steps: | 166 // When this method is invoked, the user agent must run the following steps: |
| 167 // 1. If this object's persistent state allowed value is false and | 167 // 1. If this object's persistent state allowed value is false and |
| 168 // sessionType is not "temporary", throw a new DOMException whose name is | 168 // sessionType is not "temporary", throw a new DOMException whose name is |
| 169 // NotSupportedError. | 169 // NotSupportedError. |
| 170 // (Chromium ensures that only session types supported by the | 170 // (Chromium ensures that only session types supported by the |
| 171 // configuration are listed in supportedSessionTypes.) | 171 // configuration are listed in supportedSessionTypes.) |
| 172 // 2. If the Key System implementation represented by this object's cdm | 172 // 2. If the Key System implementation represented by this object's cdm |
| (...skipping 24 matching lines...) Expand all Loading... |
| 197 // 1. If the Key System implementation represented by this object's cdm | 197 // 1. If the Key System implementation represented by this object's cdm |
| 198 // implementation value does not support server certificates, return | 198 // implementation value does not support server certificates, return |
| 199 // a promise resolved with false. | 199 // a promise resolved with false. |
| 200 // TODO(jrummell): Provide a way to determine if the CDM supports this. | 200 // TODO(jrummell): Provide a way to determine if the CDM supports this. |
| 201 // http://crbug.com/647816. | 201 // http://crbug.com/647816. |
| 202 // | 202 // |
| 203 // 2. If serverCertificate is an empty array, return a promise rejected | 203 // 2. If serverCertificate is an empty array, return a promise rejected |
| 204 // with a new a newly created TypeError. | 204 // with a new a newly created TypeError. |
| 205 if (!serverCertificate.byteLength()) { | 205 if (!serverCertificate.byteLength()) { |
| 206 return ScriptPromise::reject( | 206 return ScriptPromise::reject( |
| 207 scriptState, V8ThrowException::createTypeError( | 207 scriptState, |
| 208 scriptState->isolate(), | 208 V8ThrowException::createTypeError( |
| 209 "The serverCertificate parameter is empty.")); | 209 scriptState->isolate(), |
| 210 "The serverCertificate parameter is empty.")); |
| 210 } | 211 } |
| 211 | 212 |
| 212 // 3. Let certificate be a copy of the contents of the serverCertificate | 213 // 3. Let certificate be a copy of the contents of the serverCertificate |
| 213 // parameter. | 214 // parameter. |
| 214 DOMArrayBuffer* serverCertificateBuffer = DOMArrayBuffer::create( | 215 DOMArrayBuffer* serverCertificateBuffer = DOMArrayBuffer::create( |
| 215 serverCertificate.data(), serverCertificate.byteLength()); | 216 serverCertificate.data(), serverCertificate.byteLength()); |
| 216 | 217 |
| 217 // 4. Let promise be a new promise. | 218 // 4. Let promise be a new promise. |
| 218 SetCertificateResultPromise* result = | 219 SetCertificateResultPromise* result = |
| 219 new SetCertificateResultPromise(scriptState, this); | 220 new SetCertificateResultPromise(scriptState, this); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Remain around if there are pending events. | 312 // Remain around if there are pending events. |
| 312 DVLOG(MEDIA_KEYS_LOG_LEVEL) | 313 DVLOG(MEDIA_KEYS_LOG_LEVEL) |
| 313 << __func__ << "(" << this << ")" | 314 << __func__ << "(" << this << ")" |
| 314 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") | 315 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") |
| 315 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); | 316 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); |
| 316 | 317 |
| 317 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; | 318 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; |
| 318 } | 319 } |
| 319 | 320 |
| 320 } // namespace blink | 321 } // namespace blink |
| OLD | NEW |