Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1587)

Side by Side Diff: Source/modules/encryptedmedia/MediaKeys.cpp

Issue 18548003: Rename ExceptionCode constants to use the names in the spec (2/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 23 matching lines...) Expand all
34 #include "modules/encryptedmedia/MediaKeySession.h" 34 #include "modules/encryptedmedia/MediaKeySession.h"
35 #include "wtf/HashSet.h" 35 #include "wtf/HashSet.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 PassRefPtr<MediaKeys> MediaKeys::create(const String& keySystem, ExceptionCode& ec) 39 PassRefPtr<MediaKeys> MediaKeys::create(const String& keySystem, ExceptionCode& ec)
40 { 40 {
41 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-media-keys-constructor>: 41 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-media-keys-constructor>:
42 // The MediaKeys(keySystem) constructor must run the following steps: 42 // The MediaKeys(keySystem) constructor must run the following steps:
43 43
44 // 1. If keySystem is null or an empty string, throw an INVALID_ACCESS_ERR e xception and abort these steps. 44 // 1. If keySystem is null or an empty string, throw an InvalidAccessError e xception and abort these steps.
45 if (keySystem.isEmpty()) { 45 if (keySystem.isEmpty()) {
46 ec = INVALID_ACCESS_ERR; 46 ec = InvalidAccessError;
47 return 0; 47 return 0;
48 } 48 }
49 49
50 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps. 50 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps.
51 if (!ContentDecryptionModule::supportsKeySystem(keySystem)) { 51 if (!ContentDecryptionModule::supportsKeySystem(keySystem)) {
52 ec = NotSupportedError; 52 ec = NotSupportedError;
53 return 0; 53 return 0;
54 } 54 }
55 55
56 // 3. Let cdm be the content decryption module corresponding to keySystem. 56 // 3. Let cdm be the content decryption module corresponding to keySystem.
(...skipping 26 matching lines...) Expand all
83 m_sessions[i]->close(); 83 m_sessions[i]->close();
84 } 84 }
85 85
86 PassRefPtr<MediaKeySession> MediaKeys::createSession(ScriptExecutionContext* con text, const String& type, Uint8Array* initData, ExceptionCode& ec) 86 PassRefPtr<MediaKeySession> MediaKeys::createSession(ScriptExecutionContext* con text, const String& type, Uint8Array* initData, ExceptionCode& ec)
87 { 87 {
88 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-createsession>: 88 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-createsession>:
89 // The createSession(type, initData) method must run the following steps: 89 // The createSession(type, initData) method must run the following steps:
90 // Note: The contents of initData are container-specific Initialization Data . 90 // Note: The contents of initData are container-specific Initialization Data .
91 91
92 // 1. If type is null or an empty string and initData is not null or an empt y string, throw an 92 // 1. If type is null or an empty string and initData is not null or an empt y string, throw an
93 // INVALID_ACCESS_ERR exception and abort these steps. 93 // InvalidAccessError exception and abort these steps.
94 if ((type.isEmpty()) && (!initData || initData->length())) { 94 if ((type.isEmpty()) && (!initData || initData->length())) {
95 ec = INVALID_ACCESS_ERR; 95 ec = InvalidAccessError;
96 return 0; 96 return 0;
97 } 97 }
98 98
99 // 2. If type contains a MIME type that is not supported or is not supported by the keySystem, throw 99 // 2. If type contains a MIME type that is not supported or is not supported by the keySystem, throw
100 // a NotSupportedError exception and abort these steps. 100 // a NotSupportedError exception and abort these steps.
101 ASSERT(!type.isEmpty()); 101 ASSERT(!type.isEmpty());
102 if (type.isEmpty() || !m_cdm->supportsMIMEType(type)) { 102 if (type.isEmpty() || !m_cdm->supportsMIMEType(type)) {
103 ec = NotSupportedError; 103 ec = NotSupportedError;
104 return 0; 104 return 0;
105 } 105 }
(...skipping 17 matching lines...) Expand all
123 123
124 void MediaKeys::setMediaElement(HTMLMediaElement* element) 124 void MediaKeys::setMediaElement(HTMLMediaElement* element)
125 { 125 {
126 // FIXME: Cause HTMLMediaElement::setMediaKeys() to throw an exception if m_ mediaElement is not 0. 126 // FIXME: Cause HTMLMediaElement::setMediaKeys() to throw an exception if m_ mediaElement is not 0.
127 // FIXME: Hook up the CDM to the WebMediaPlayer in Chromium. 127 // FIXME: Hook up the CDM to the WebMediaPlayer in Chromium.
128 ASSERT(!m_mediaElement); 128 ASSERT(!m_mediaElement);
129 m_mediaElement = element; 129 m_mediaElement = element;
130 } 130 }
131 131
132 } 132 }
OLDNEW
« no previous file with comments | « Source/modules/encryptedmedia/MediaKeySession.cpp ('k') | Source/modules/indexeddb/IDBCursor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698