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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-media-keys-constructor>: | 46 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-media-keys-constructor>: |
47 // The MediaKeys(keySystem) constructor must run the following steps: | 47 // The MediaKeys(keySystem) constructor must run the following steps: |
48 | 48 |
49 // 1. If keySystem is null or an empty string, throw an InvalidAccessError e xception and abort these steps. | 49 // 1. If keySystem is null or an empty string, throw an InvalidAccessError e xception and abort these steps. |
50 if (keySystem.isEmpty()) { | 50 if (keySystem.isEmpty()) { |
51 exceptionState.throwDOMException(InvalidAccessError, "The key system pro vided is invalid."); | 51 exceptionState.throwDOMException(InvalidAccessError, "The key system pro vided is invalid."); |
52 return nullptr; | 52 return nullptr; |
53 } | 53 } |
54 | 54 |
55 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps. | 55 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps. |
56 if (!ContentDecryptionModule::supportsKeySystem(keySystem)) { | 56 if (!isTypeSupported(keySystem, "")) { |
ddorwin
2014/02/27 22:44:13
I don't think we should use the public function fo
jrummell
2014/02/27 23:20:00
Done.
| |
57 exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported."); | 57 exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported."); |
58 return nullptr; | 58 return nullptr; |
59 } | 59 } |
60 | 60 |
61 // 3. Let cdm be the content decryption module corresponding to keySystem. | 61 // 3. Let cdm be the content decryption module corresponding to keySystem. |
62 // 4. Load cdm if necessary. | 62 // 4. Load cdm if necessary. |
63 OwnPtr<ContentDecryptionModule> cdm = ContentDecryptionModule::create(keySys tem); | 63 OwnPtr<ContentDecryptionModule> cdm = ContentDecryptionModule::create(keySys tem); |
64 if (!cdm) { | 64 if (!cdm) { |
65 exceptionState.throwDOMException(NotSupportedError, "A content decryptio n module could not be loaded for the '" + keySystem + "' key system."); | 65 exceptionState.throwDOMException(NotSupportedError, "A content decryptio n module could not be loaded for the '" + keySystem + "' key system."); |
66 return nullptr; | 66 return nullptr; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 return nullptr; | 101 return nullptr; |
102 } | 102 } |
103 | 103 |
104 if (!initData || !initData->length()) { | 104 if (!initData || !initData->length()) { |
105 exceptionState.throwDOMException(InvalidAccessError, "The initData provi ded is null or empty."); | 105 exceptionState.throwDOMException(InvalidAccessError, "The initData provi ded is null or empty."); |
106 return nullptr; | 106 return nullptr; |
107 } | 107 } |
108 | 108 |
109 // 1. If type contains a MIME type that is not supported or is not supported by the keySystem, | 109 // 1. If type contains a MIME type that is not supported or is not supported by the keySystem, |
110 // throw a NOT_SUPPORTED_ERR exception and abort these steps. | 110 // throw a NOT_SUPPORTED_ERR exception and abort these steps. |
111 if (!m_cdm->supportsMIMEType(contentType)) { | 111 if (!isTypeSupported(m_keySystem, contentType)) { |
ddorwin
2014/02/27 22:44:13
~Ditto, except maybe step 4 of IST gets encapsulat
jrummell
2014/02/27 23:20:00
Done.
| |
112 exceptionState.throwDOMException(NotSupportedError, "The type provided ( '" + contentType + "') is unsupported."); | 112 exceptionState.throwDOMException(NotSupportedError, "The type provided ( '" + contentType + "') is unsupported."); |
113 return nullptr; | 113 return nullptr; |
114 } | 114 } |
115 | 115 |
116 // 2. Create a new MediaKeySession object. | 116 // 2. Create a new MediaKeySession object. |
117 RefPtrWillBeRawPtr<MediaKeySession> session = MediaKeySession::create(contex t, m_cdm.get(), m_weakFactory.createWeakPtr()); | 117 RefPtrWillBeRawPtr<MediaKeySession> session = MediaKeySession::create(contex t, m_cdm.get(), m_weakFactory.createWeakPtr()); |
118 // 2.1 Let the keySystem attribute be keySystem. | 118 // 2.1 Let the keySystem attribute be keySystem. |
119 ASSERT(!session->keySystem().isEmpty()); | 119 ASSERT(!session->keySystem().isEmpty()); |
120 // FIXME: 2.2 Let the state of the session be CREATED. | 120 // FIXME: 2.2 Let the state of the session be CREATED. |
121 | 121 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 | 192 |
193 void MediaKeys::contextDestroyed() | 193 void MediaKeys::contextDestroyed() |
194 { | 194 { |
195 ContextLifecycleObserver::contextDestroyed(); | 195 ContextLifecycleObserver::contextDestroyed(); |
196 | 196 |
197 // We don't need the CDM anymore. | 197 // We don't need the CDM anymore. |
198 m_cdm.clear(); | 198 m_cdm.clear(); |
199 } | 199 } |
200 | 200 |
201 } | 201 } |
OLD | NEW |