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 3 // found in the LICENSE file. 4 5 #ifndef WebContentDecryptionModuleResult_h 6 #define WebContentDecryptionModuleResult_h 7 8 #include "WebCommon.h" 9 #include "WebContentDecryptionModuleException.h" 10 #include "WebPrivatePtr.h" 11 12 namespace WebCore { 13 class ContentDecryptionModuleResult; 14 } 15 16 namespace blink { 17 18 class WebString; 19 20 class WebContentDecryptionModuleResult { 21 public: 22 enum SessionStatus { 23 // New session has been initialized. 24 NewSession, 25 26 // CDM could not find the requested session. 27 SessionNotFound, 28 29 // CDM already has a non-closed session that matches the provided 30 // parameters. 31 SessionAlreadyExists, 32 }; 33 WebContentDecryptionModuleResult(const WebContentDecryptionModuleResult & o)34 WebContentDecryptionModuleResult(const WebContentDecryptionModuleResult& o) 35 { 36 assign(o); 37 } 38 ~WebContentDecryptionModuleResult()39 ~WebContentDecryptionModuleResult() 40 { 41 reset(); 42 } 43 44 WebContentDecryptionModuleResult& operator=(const WebContentDecryptionModuleResult& o) 45 { 46 assign(o); 47 return *this; 48 } 49 50 // Called when the CDM completes an operation and has no additional data to 51 // pass back. 52 BLINK_PLATFORM_EXPORT void complete(); 53 54 // Called when the CDM completes a session operation. 55 BLINK_PLATFORM_EXPORT void completeWithSession(SessionStatus); 56 57 // Called when the operation fails. 58 BLINK_PLATFORM_EXPORT void completeWithError(WebContentDecryptionModuleException, unsigned long systemCode, const WebString& message); 59 60 #if INSIDE_BLINK 61 BLINK_PLATFORM_EXPORT explicit WebContentDecryptionModuleResult(WebCore::ContentDecryptionModuleResult*); 62 #endif 63 64 private: 65 BLINK_PLATFORM_EXPORT void reset(); 66 BLINK_PLATFORM_EXPORT void assign(const WebContentDecryptionModuleResult&); 67 68 WebPrivatePtr<WebCore::ContentDecryptionModuleResult> m_impl; 69 }; 70 71 } // namespace blink 72 73 #endif // WebContentDecryptionModuleSession_h 74