ppp_content_decryptor_private_proxy.h revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
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.
4
5#ifndef PPAPI_PROXY_PPP_CONTENT_DECRYPTOR_PRIVATE_PROXY_H_
6#define PPAPI_PROXY_PPP_CONTENT_DECRYPTOR_PRIVATE_PROXY_H_
7
8#include <string>
9#include <vector>
10
11#include "ppapi/c/pp_instance.h"
12#include "ppapi/c/private/ppp_content_decryptor_private.h"
13#include "ppapi/proxy/interface_proxy.h"
14#include "ppapi/proxy/serialized_structs.h"
15#include "ppapi/shared_impl/host_resource.h"
16
17namespace ppapi {
18namespace proxy {
19
20class SerializedVarReceiveInput;
21
22class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy {
23 public:
24  explicit PPP_ContentDecryptor_Private_Proxy(Dispatcher* dispatcher);
25  virtual ~PPP_ContentDecryptor_Private_Proxy();
26
27  static const PPP_ContentDecryptor_Private* GetProxyInterface();
28
29 private:
30  // InterfaceProxy implementation.
31  virtual bool OnMessageReceived(const IPC::Message& msg);
32
33  // Message handlers.
34  void OnMsgInitialize(PP_Instance instance,
35                       SerializedVarReceiveInput key_system);
36  void OnMsgSetServerCertificate(PP_Instance instance,
37                                 uint32_t promise_id,
38                                 std::vector<uint8_t> server_certificate);
39  void OnMsgCreateSession(PP_Instance instance,
40                          uint32_t promise_id,
41                          SerializedVarReceiveInput init_data_type,
42                          SerializedVarReceiveInput init_data,
43                          PP_SessionType session_type);
44  void OnMsgLoadSession(PP_Instance instance,
45                        uint32_t promise_id,
46                        SerializedVarReceiveInput web_session_id);
47  void OnMsgUpdateSession(PP_Instance instance,
48                          uint32_t promise_id,
49                          SerializedVarReceiveInput web_session_id,
50                          SerializedVarReceiveInput response);
51  void OnMsgCloseSession(PP_Instance instance,
52                         uint32_t promise_id,
53                         const std::string& web_session_id);
54  void OnMsgRemoveSession(PP_Instance instance,
55                          uint32_t promise_id,
56                          const std::string& web_session_id);
57  void OnMsgGetUsableKeyIds(PP_Instance instance,
58                            uint32_t promise_id,
59                            const std::string& web_session_id);
60  void OnMsgDecrypt(PP_Instance instance,
61                    const PPPDecryptor_Buffer& encrypted_buffer,
62                    const std::string& serialized_encrypted_block_info);
63  void OnMsgInitializeAudioDecoder(
64      PP_Instance instance,
65      const std::string& decoder_config,
66      const PPPDecryptor_Buffer& extra_data_buffer);
67  void OnMsgInitializeVideoDecoder(
68      PP_Instance instance,
69      const std::string& decoder_config,
70      const PPPDecryptor_Buffer& extra_data_buffer);
71  void OnMsgDeinitializeDecoder(PP_Instance instance,
72                                PP_DecryptorStreamType decoder_type,
73                                uint32_t request_id);
74  void OnMsgResetDecoder(PP_Instance instance,
75                         PP_DecryptorStreamType decoder_type,
76                         uint32_t request_id);
77  void OnMsgDecryptAndDecode(
78      PP_Instance instance,
79      PP_DecryptorStreamType decoder_type,
80      const PPPDecryptor_Buffer& encrypted_buffer,
81      const std::string& serialized_encrypted_block_info);
82
83  const PPP_ContentDecryptor_Private* ppp_decryptor_impl_;
84
85  DISALLOW_COPY_AND_ASSIGN(PPP_ContentDecryptor_Private_Proxy);
86};
87
88}  // namespace proxy
89}  // namespace ppapi
90
91#endif  // PPAPI_PROXY_PPP_CONTENT_DECRYPTOR_PRIVATE_PROXY_H_
92