Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / WebContentDecryptionModuleResult.h
blob9d16de997517112ef96501044288607c8f9e779e
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.
5 #ifndef WebContentDecryptionModuleResult_h
6 #define WebContentDecryptionModuleResult_h
8 #include "WebCommon.h"
9 #include "WebContentDecryptionModuleException.h"
10 #include "WebPrivatePtr.h"
12 namespace blink {
14 class ContentDecryptionModuleResult;
15 class WebContentDecryptionModule;
16 class WebString;
18 class WebContentDecryptionModuleResult {
19 public:
20 enum SessionStatus {
21 // New session has been initialized.
22 NewSession,
24 // CDM could not find the requested session.
25 SessionNotFound,
27 // CDM already has a non-closed session that matches the provided
28 // parameters.
29 SessionAlreadyExists,
32 WebContentDecryptionModuleResult(const WebContentDecryptionModuleResult& o)
34 assign(o);
37 ~WebContentDecryptionModuleResult()
39 reset();
42 WebContentDecryptionModuleResult& operator=(const WebContentDecryptionModuleResult& o)
44 assign(o);
45 return *this;
48 // Called when the CDM completes an operation and has no additional data to
49 // pass back.
50 BLINK_PLATFORM_EXPORT void complete();
52 // Called when a CDM is created.
53 BLINK_PLATFORM_EXPORT void completeWithContentDecryptionModule(WebContentDecryptionModule*);
55 // Called when the CDM completes a session operation.
56 BLINK_PLATFORM_EXPORT void completeWithSession(SessionStatus);
58 // Called when the operation fails.
59 BLINK_PLATFORM_EXPORT void completeWithError(WebContentDecryptionModuleException, unsigned long systemCode, const WebString& message);
61 #if INSIDE_BLINK
62 BLINK_PLATFORM_EXPORT explicit WebContentDecryptionModuleResult(ContentDecryptionModuleResult*);
63 #endif
65 private:
66 BLINK_PLATFORM_EXPORT void reset();
67 BLINK_PLATFORM_EXPORT void assign(const WebContentDecryptionModuleResult&);
69 WebPrivatePtr<ContentDecryptionModuleResult, WebPrivatePtrDestructionCrossThread> m_impl;
72 } // namespace blink
74 #endif // WebContentDecryptionModuleSession_h