blob: c70b564367e3f6ef037f7a9f4a368148c22e1054 [file] [log] [blame]
[email protected]0f4e4350692012-03-07 06:07:141// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]f6b8a8d2010-11-05 22:13:392// 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_CLASS_PROXY_H_
6#define PPAPI_PROXY_PPP_CLASS_PROXY_H_
7
avie029c4132015-12-23 06:45:228#include <stdint.h>
9
[email protected]f6b8a8d2010-11-05 22:13:3910#include <vector>
11
avie029c4132015-12-23 06:45:2212#include "base/macros.h"
[email protected]0f4e4350692012-03-07 06:07:1413#include "ppapi/c/pp_instance.h"
[email protected]f6b8a8d2010-11-05 22:13:3914#include "ppapi/c/pp_var.h"
15#include "ppapi/proxy/interface_proxy.h"
16
17struct PPB_Var_Deprecated;
[email protected]f6b8a8d2010-11-05 22:13:3918
[email protected]4d2efd22011-08-18 21:58:0219namespace ppapi {
[email protected]f6b8a8d2010-11-05 22:13:3920namespace proxy {
21
22class SerializedVar;
23class SerializedVarReceiveInput;
24class SerializedVarVectorReceiveInput;
25class SerializedVarOutParam;
26class SerializedVarReturnValue;
27
28class PPP_Class_Proxy : public InterfaceProxy {
29 public:
30 // PPP_Class isn't a normal interface that you can query for, so this
31 // constructor doesn't take an interface pointer.
[email protected]0a6d5f62011-11-11 08:04:0732 explicit PPP_Class_Proxy(Dispatcher* dispatcher);
[email protected]f6b8a8d2010-11-05 22:13:3933 virtual ~PPP_Class_Proxy();
34
[email protected]5c966022011-09-13 18:09:3735 // Factory function used for registration (normal code can just use the
36 // constructor).
37 static InterfaceProxy* Create(Dispatcher* dispatcher);
38
[email protected]f6b8a8d2010-11-05 22:13:3939 // Creates a proxied object in the browser process. This takes the browser's
40 // PPB_Var_Deprecated interface to use to create the object. The class and
41 static PP_Var CreateProxiedObject(const PPB_Var_Deprecated* var,
42 Dispatcher* dispatcher,
[email protected]0f4e4350692012-03-07 06:07:1443 PP_Instance instance_id,
avie029c4132015-12-23 06:45:2244 int64_t ppp_class,
45 int64_t class_data);
[email protected]f6b8a8d2010-11-05 22:13:3946
[email protected]c23bcaf2011-11-05 00:07:3647 static PP_Bool IsInstanceOf(const PPB_Var_Deprecated* ppb_var_impl,
48 const PP_Var& var,
avie029c4132015-12-23 06:45:2249 int64_t ppp_class,
50 int64_t* ppp_class_data);
[email protected]c23bcaf2011-11-05 00:07:3651
[email protected]f6b8a8d2010-11-05 22:13:3952 // InterfaceProxy implementation.
[email protected]a95986a82010-12-24 06:19:2853 virtual bool OnMessageReceived(const IPC::Message& msg);
[email protected]f6b8a8d2010-11-05 22:13:3954
55 private:
56 // IPC message handlers.
avie029c4132015-12-23 06:45:2257 void OnMsgHasProperty(int64_t ppp_class,
58 int64_t object,
[email protected]f6b8a8d2010-11-05 22:13:3959 SerializedVarReceiveInput property,
60 SerializedVarOutParam exception,
61 bool* result);
avie029c4132015-12-23 06:45:2262 void OnMsgHasMethod(int64_t ppp_class,
63 int64_t object,
[email protected]f6b8a8d2010-11-05 22:13:3964 SerializedVarReceiveInput property,
65 SerializedVarOutParam exception,
66 bool* result);
avie029c4132015-12-23 06:45:2267 void OnMsgGetProperty(int64_t ppp_class,
68 int64_t object,
[email protected]f6b8a8d2010-11-05 22:13:3969 SerializedVarReceiveInput property,
70 SerializedVarOutParam exception,
71 SerializedVarReturnValue result);
avie029c4132015-12-23 06:45:2272 void OnMsgEnumerateProperties(int64_t ppp_class,
73 int64_t object,
74 std::vector<SerializedVar>* props,
75 SerializedVarOutParam exception);
76 void OnMsgSetProperty(int64_t ppp_class,
77 int64_t object,
[email protected]f6b8a8d2010-11-05 22:13:3978 SerializedVarReceiveInput property,
79 SerializedVarReceiveInput value,
80 SerializedVarOutParam exception);
avie029c4132015-12-23 06:45:2281 void OnMsgRemoveProperty(int64_t ppp_class,
82 int64_t object,
[email protected]f6b8a8d2010-11-05 22:13:3983 SerializedVarReceiveInput property,
84 SerializedVarOutParam exception);
avie029c4132015-12-23 06:45:2285 void OnMsgCall(int64_t ppp_class,
86 int64_t object,
[email protected]f6b8a8d2010-11-05 22:13:3987 SerializedVarReceiveInput method_name,
88 SerializedVarVectorReceiveInput arg_vector,
89 SerializedVarOutParam exception,
90 SerializedVarReturnValue result);
avie029c4132015-12-23 06:45:2291 void OnMsgConstruct(int64_t ppp_class,
92 int64_t object,
[email protected]f6b8a8d2010-11-05 22:13:3993 SerializedVarVectorReceiveInput arg_vector,
94 SerializedVarOutParam exception,
95 SerializedVarReturnValue result);
avie029c4132015-12-23 06:45:2296 void OnMsgDeallocate(int64_t ppp_class, int64_t object);
[email protected]f6b8a8d2010-11-05 22:13:3997
[email protected]edb5b052012-06-18 19:41:3098 // Returns true if the given class/data points to a plugin-implemented
99 // object. On failure, the exception, if non-NULL, will also be set.
avie029c4132015-12-23 06:45:22100 bool ValidateUserData(int64_t ppp_class,
101 int64_t class_data,
[email protected]edb5b052012-06-18 19:41:30102 SerializedVarOutParam* exception);
103
[email protected]f6b8a8d2010-11-05 22:13:39104 DISALLOW_COPY_AND_ASSIGN(PPP_Class_Proxy);
105};
106
107} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02108} // namespace ppapi
[email protected]f6b8a8d2010-11-05 22:13:39109
110#endif // PPAPI_PROXY_PPP_CLASS_PROXY_H_