1// Copyright (c) 2011 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_PPB_VAR_DEPRECATED_PROXY_H_
6#define PPAPI_PROXY_PPB_VAR_DEPRECATED_PROXY_H_
7
8#include <vector>
9
10#include "base/memory/weak_ptr.h"
11#include "ppapi/c/pp_instance.h"
12#include "ppapi/proxy/interface_proxy.h"
13
14struct PPB_Var_Deprecated;
15
16namespace ppapi {
17namespace proxy {
18
19class SerializedVar;
20class SerializedVarReceiveInput;
21class SerializedVarVectorOutParam;
22class SerializedVarVectorReceiveInput;
23class SerializedVarOutParam;
24class SerializedVarReturnValue;
25
26class PPB_Var_Deprecated_Proxy : public InterfaceProxy {
27 public:
28  explicit PPB_Var_Deprecated_Proxy(Dispatcher* dispatcher);
29  virtual ~PPB_Var_Deprecated_Proxy();
30
31  static const PPB_Var_Deprecated* GetProxyInterface();
32
33  // InterfaceProxy implementation.
34  virtual bool OnMessageReceived(const IPC::Message& msg);
35
36 private:
37  // Message handlers.
38  void OnMsgAddRefObject(int64 object_id);
39  void OnMsgReleaseObject(int64 object_id);
40  void OnMsgHasProperty(SerializedVarReceiveInput var,
41                        SerializedVarReceiveInput name,
42                        SerializedVarOutParam exception,
43                        PP_Bool* result);
44  void OnMsgHasMethodDeprecated(SerializedVarReceiveInput var,
45                                SerializedVarReceiveInput name,
46                                SerializedVarOutParam exception,
47                                PP_Bool* result);
48  void OnMsgGetProperty(SerializedVarReceiveInput var,
49                        SerializedVarReceiveInput name,
50                        SerializedVarOutParam exception,
51                        SerializedVarReturnValue result);
52  void OnMsgEnumerateProperties(
53      SerializedVarReceiveInput var,
54      SerializedVarVectorOutParam props,
55      SerializedVarOutParam exception);
56  void OnMsgSetPropertyDeprecated(SerializedVarReceiveInput var,
57                                  SerializedVarReceiveInput name,
58                                  SerializedVarReceiveInput value,
59                                  SerializedVarOutParam exception);
60  void OnMsgDeleteProperty(SerializedVarReceiveInput var,
61                           SerializedVarReceiveInput name,
62                           SerializedVarOutParam exception,
63                           PP_Bool* result);
64  void OnMsgCall(SerializedVarReceiveInput object,
65                 SerializedVarReceiveInput this_object,
66                 SerializedVarReceiveInput method_name,
67                 SerializedVarVectorReceiveInput arg_vector,
68                 SerializedVarOutParam exception,
69                 SerializedVarReturnValue result);
70  void OnMsgCallDeprecated(SerializedVarReceiveInput object,
71                           SerializedVarReceiveInput method_name,
72                           SerializedVarVectorReceiveInput arg_vector,
73                           SerializedVarOutParam exception,
74                           SerializedVarReturnValue result);
75  void OnMsgConstruct(SerializedVarReceiveInput var,
76                      SerializedVarVectorReceiveInput arg_vector,
77                      SerializedVarOutParam exception,
78                      SerializedVarReturnValue result);
79  void OnMsgIsInstanceOfDeprecated(SerializedVarReceiveInput var,
80                                   int64 ppp_class,
81                                   int64* ppp_class_data,
82                                   PP_Bool* result);
83  void OnMsgCreateObjectDeprecated(PP_Instance instance,
84                                   int64 ppp_class,
85                                   int64 ppp_class_data,
86                                   SerializedVarReturnValue result);
87
88  // Call in the host for messages that can be reentered.
89  void SetAllowPluginReentrancy();
90
91  void DoReleaseObject(int64 object_id);
92
93  const PPB_Var_Deprecated* ppb_var_impl_;
94
95  base::WeakPtrFactory<PPB_Var_Deprecated_Proxy> task_factory_;
96
97  DISALLOW_COPY_AND_ASSIGN(PPB_Var_Deprecated_Proxy);
98};
99
100}  // namespace proxy
101}  // namespace ppapi
102
103#endif  // PPAPI_PROXY_PPB_VAR_DEPRECATED_PROXY_H_
104