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

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

Issue 464353002: Cleanup blink:: prefix usage in Source/core/modules/[battery/*.cpp to indexeddb/*.cpp] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 4 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
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h" 6 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h"
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
11 #include "bindings/core/v8/V8Binding.h" 11 #include "bindings/core/v8/V8Binding.h"
12 #include "core/dom/DOMException.h" 12 #include "core/dom/DOMException.h"
13 #include "platform/Logging.h" 13 #include "platform/Logging.h"
14 #include "public/platform/WebString.h" 14 #include "public/platform/WebString.h"
15 #include "wtf/Assertions.h" 15 #include "wtf/Assertions.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 ExceptionCode WebCdmExceptionToExceptionCode(blink::WebContentDecryptionModuleEx ception cdmException) 19 ExceptionCode WebCdmExceptionToExceptionCode(WebContentDecryptionModuleException cdmException)
20 { 20 {
21 switch (cdmException) { 21 switch (cdmException) {
22 case blink::WebContentDecryptionModuleExceptionNotSupportedError: 22 case WebContentDecryptionModuleExceptionNotSupportedError:
23 return NotSupportedError; 23 return NotSupportedError;
24 case blink::WebContentDecryptionModuleExceptionInvalidStateError: 24 case WebContentDecryptionModuleExceptionInvalidStateError:
25 return InvalidStateError; 25 return InvalidStateError;
26 case blink::WebContentDecryptionModuleExceptionInvalidAccessError: 26 case WebContentDecryptionModuleExceptionInvalidAccessError:
27 return InvalidAccessError; 27 return InvalidAccessError;
28 case blink::WebContentDecryptionModuleExceptionQuotaExceededError: 28 case WebContentDecryptionModuleExceptionQuotaExceededError:
29 return QuotaExceededError; 29 return QuotaExceededError;
30 case blink::WebContentDecryptionModuleExceptionUnknownError: 30 case WebContentDecryptionModuleExceptionUnknownError:
31 return UnknownError; 31 return UnknownError;
32 case blink::WebContentDecryptionModuleExceptionClientError: 32 case WebContentDecryptionModuleExceptionClientError:
33 case blink::WebContentDecryptionModuleExceptionOutputError: 33 case WebContentDecryptionModuleExceptionOutputError:
34 // Currently no matching DOMException for these 2 errors. 34 // Currently no matching DOMException for these 2 errors.
35 // FIXME: Update DOMException to handle these if actually added to 35 // FIXME: Update DOMException to handle these if actually added to
36 // the EME spec. 36 // the EME spec.
37 return UnknownError; 37 return UnknownError;
38 } 38 }
39 39
40 ASSERT_NOT_REACHED(); 40 ASSERT_NOT_REACHED();
41 return UnknownError; 41 return UnknownError;
42 } 42 }
43 43
44 SimpleContentDecryptionModuleResult::SimpleContentDecryptionModuleResult(ScriptS tate* scriptState) 44 SimpleContentDecryptionModuleResult::SimpleContentDecryptionModuleResult(ScriptS tate* scriptState)
45 : m_resolver(ScriptPromiseResolver::create(scriptState)) 45 : m_resolver(ScriptPromiseResolver::create(scriptState))
46 { 46 {
47 } 47 }
48 48
49 SimpleContentDecryptionModuleResult::~SimpleContentDecryptionModuleResult() 49 SimpleContentDecryptionModuleResult::~SimpleContentDecryptionModuleResult()
50 { 50 {
51 } 51 }
52 52
53 void SimpleContentDecryptionModuleResult::complete() 53 void SimpleContentDecryptionModuleResult::complete()
54 { 54 {
55 m_resolver->resolve(V8UndefinedType()); 55 m_resolver->resolve(V8UndefinedType());
56 m_resolver.clear(); 56 m_resolver.clear();
57 } 57 }
58 58
59 void SimpleContentDecryptionModuleResult::completeWithSession(blink::WebContentD ecryptionModuleResult::SessionStatus status) 59 void SimpleContentDecryptionModuleResult::completeWithSession(WebContentDecrypti onModuleResult::SessionStatus status)
60 { 60 {
61 ASSERT_NOT_REACHED(); 61 ASSERT_NOT_REACHED();
62 completeWithDOMException(InvalidStateError, "Unexpected completion."); 62 completeWithDOMException(InvalidStateError, "Unexpected completion.");
63 } 63 }
64 64
65 void SimpleContentDecryptionModuleResult::completeWithError(blink::WebContentDec ryptionModuleException exceptionCode, unsigned long systemCode, const blink::Web String& errorMessage) 65 void SimpleContentDecryptionModuleResult::completeWithError(WebContentDecryption ModuleException exceptionCode, unsigned long systemCode, const WebString& errorM essage)
66 { 66 {
67 completeWithDOMException(WebCdmExceptionToExceptionCode(exceptionCode), erro rMessage); 67 completeWithDOMException(WebCdmExceptionToExceptionCode(exceptionCode), erro rMessage);
68 } 68 }
69 69
70 ScriptPromise SimpleContentDecryptionModuleResult::promise() 70 ScriptPromise SimpleContentDecryptionModuleResult::promise()
71 { 71 {
72 return m_resolver->promise(); 72 return m_resolver->promise();
73 } 73 }
74 74
75 void SimpleContentDecryptionModuleResult::completeWithDOMException(ExceptionCode code, const String& errorMessage) 75 void SimpleContentDecryptionModuleResult::completeWithDOMException(ExceptionCode code, const String& errorMessage)
76 { 76 {
77 m_resolver->reject(DOMException::create(code, errorMessage)); 77 m_resolver->reject(DOMException::create(code, errorMessage));
78 m_resolver.clear(); 78 m_resolver.clear();
79 } 79 }
80 80
81 } // namespace blink 81 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/encryptedmedia/MediaKeysController.cpp ('k') | Source/modules/filesystem/DOMFileSystemBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698