Don't announce clipboard events if the event target is not visible and focused.
[chromium-blink-merge.git] / ppapi / cpp / private / content_decryptor_private.h
blob35359a0fe98b4a1325bf049941ac63b81f51eb70
1 // Copyright (c) 2012 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 PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_
8 #include <string>
9 #include <vector>
11 #include "ppapi/c/private/pp_content_decryptor.h"
12 #include "ppapi/c/private/ppb_content_decryptor_private.h"
13 #include "ppapi/c/private/ppp_content_decryptor_private.h"
15 #include "ppapi/cpp/dev/buffer_dev.h"
16 #include "ppapi/cpp/instance_handle.h"
17 #include "ppapi/cpp/var.h"
18 #include "ppapi/cpp/var_array_buffer.h"
20 namespace pp {
22 class Instance;
24 // TODO(tomfinegan): Remove redundant pp:: usage, and pass VarArrayBuffers as
25 // const references.
27 class ContentDecryptor_Private {
28 public:
29 explicit ContentDecryptor_Private(Instance* instance);
30 virtual ~ContentDecryptor_Private();
32 // PPP_ContentDecryptor_Private functions exposed as virtual functions
33 // for you to override.
34 // TODO(tomfinegan): This could be optimized to pass pp::Var instead of
35 // strings. The change would allow the CDM wrapper to reuse vars when
36 // replying to the browser.
37 virtual void Initialize(const std::string& key_system,
38 bool allow_distinctive_identifier,
39 bool allow_persistent_state) = 0;
40 virtual void SetServerCertificate(uint32_t promise_id,
41 pp::VarArrayBuffer server_certificate) = 0;
42 virtual void CreateSessionAndGenerateRequest(
43 uint32_t promise_id,
44 PP_SessionType session_type,
45 const std::string& init_data_type,
46 pp::VarArrayBuffer init_data) = 0;
47 virtual void LoadSession(uint32_t promise_id,
48 PP_SessionType session_type,
49 const std::string& session_id) = 0;
50 virtual void UpdateSession(uint32_t promise_id,
51 const std::string& session_id,
52 pp::VarArrayBuffer response) = 0;
53 virtual void CloseSession(uint32_t promise_id,
54 const std::string& session_id) = 0;
55 virtual void RemoveSession(uint32_t promise_id,
56 const std::string& session_id) = 0;
57 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer,
58 const PP_EncryptedBlockInfo& encrypted_block_info) = 0;
59 virtual void InitializeAudioDecoder(
60 const PP_AudioDecoderConfig& decoder_config,
61 pp::Buffer_Dev extra_data_resource) = 0;
62 virtual void InitializeVideoDecoder(
63 const PP_VideoDecoderConfig& decoder_config,
64 pp::Buffer_Dev extra_data_resource) = 0;
65 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type,
66 uint32_t request_id) = 0;
67 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type,
68 uint32_t request_id) = 0;
69 // Null |encrypted_frame| means end-of-stream buffer.
70 virtual void DecryptAndDecode(
71 PP_DecryptorStreamType decoder_type,
72 pp::Buffer_Dev encrypted_buffer,
73 const PP_EncryptedBlockInfo& encrypted_block_info) = 0;
75 // PPB_ContentDecryptor_Private methods for passing data from the decryptor
76 // to the browser.
77 void PromiseResolved(uint32_t promise_id);
78 void PromiseResolvedWithSession(uint32_t promise_id,
79 const std::string& session_id);
80 void PromiseRejected(uint32_t promise_id,
81 PP_CdmExceptionCode exception_code,
82 uint32_t system_code,
83 const std::string& error_description);
84 void SessionMessage(const std::string& session_id,
85 PP_CdmMessageType message_type,
86 pp::VarArrayBuffer message,
87 const std::string& legacy_destination_url);
88 void SessionKeysChange(const std::string& session_id,
89 bool has_additional_usable_key,
90 const std::vector<PP_KeyInformation>& key_information);
91 void SessionExpirationChange(const std::string& session_id,
92 PP_Time new_expiry_time);
93 void SessionClosed(const std::string& session_id);
94 void SessionError(const std::string& session_id,
95 PP_CdmExceptionCode exception_code,
96 uint32_t system_code,
97 const std::string& error_description);
99 // The plugin must not hold a reference to the encrypted buffer resource
100 // provided to Decrypt() when it calls this method. The browser will reuse
101 // the buffer in a subsequent Decrypt() call.
102 void DeliverBlock(pp::Buffer_Dev decrypted_block,
103 const PP_DecryptedBlockInfo& decrypted_block_info);
105 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type,
106 uint32_t request_id,
107 bool status);
108 void DecoderDeinitializeDone(PP_DecryptorStreamType decoder_type,
109 uint32_t request_id);
110 void DecoderResetDone(PP_DecryptorStreamType decoder_type,
111 uint32_t request_id);
113 // The plugin must not hold a reference to the encrypted buffer resource
114 // provided to DecryptAndDecode() when it calls this method. The browser will
115 // reuse the buffer in a subsequent DecryptAndDecode() call.
116 void DeliverFrame(pp::Buffer_Dev decrypted_frame,
117 const PP_DecryptedFrameInfo& decrypted_frame_info);
119 // The plugin must not hold a reference to the encrypted buffer resource
120 // provided to DecryptAndDecode() when it calls this method. The browser will
121 // reuse the buffer in a subsequent DecryptAndDecode() call.
122 void DeliverSamples(pp::Buffer_Dev audio_frames,
123 const PP_DecryptedSampleInfo& decrypted_sample_info);
125 private:
126 InstanceHandle associated_instance_;
129 } // namespace pp
131 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_