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