[email protected] | 0f4e435069 | 2012-03-07 06:07:14 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 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_CLASS_PROXY_H_ |
| 6 | #define PPAPI_PROXY_PPP_CLASS_PROXY_H_ |
| 7 | |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 12 | #include "base/macros.h" |
[email protected] | 0f4e435069 | 2012-03-07 06:07:14 | [diff] [blame] | 13 | #include "ppapi/c/pp_instance.h" |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 14 | #include "ppapi/c/pp_var.h" |
| 15 | #include "ppapi/proxy/interface_proxy.h" |
| 16 | |
| 17 | struct PPB_Var_Deprecated; |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 18 | |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 19 | namespace ppapi { |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 20 | namespace proxy { |
| 21 | |
| 22 | class SerializedVar; |
| 23 | class SerializedVarReceiveInput; |
| 24 | class SerializedVarVectorReceiveInput; |
| 25 | class SerializedVarOutParam; |
| 26 | class SerializedVarReturnValue; |
| 27 | |
| 28 | class 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] | 0a6d5f6 | 2011-11-11 08:04:07 | [diff] [blame] | 32 | explicit PPP_Class_Proxy(Dispatcher* dispatcher); |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 33 | virtual ~PPP_Class_Proxy(); |
| 34 | |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 35 | // Factory function used for registration (normal code can just use the |
| 36 | // constructor). |
| 37 | static InterfaceProxy* Create(Dispatcher* dispatcher); |
| 38 | |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 39 | // 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] | 0f4e435069 | 2012-03-07 06:07:14 | [diff] [blame] | 43 | PP_Instance instance_id, |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 44 | int64_t ppp_class, |
| 45 | int64_t class_data); |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 46 | |
[email protected] | c23bcaf | 2011-11-05 00:07:36 | [diff] [blame] | 47 | static PP_Bool IsInstanceOf(const PPB_Var_Deprecated* ppb_var_impl, |
| 48 | const PP_Var& var, |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 49 | int64_t ppp_class, |
| 50 | int64_t* ppp_class_data); |
[email protected] | c23bcaf | 2011-11-05 00:07:36 | [diff] [blame] | 51 | |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 52 | // InterfaceProxy implementation. |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 53 | virtual bool OnMessageReceived(const IPC::Message& msg); |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 54 | |
| 55 | private: |
| 56 | // IPC message handlers. |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 57 | void OnMsgHasProperty(int64_t ppp_class, |
| 58 | int64_t object, |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 59 | SerializedVarReceiveInput property, |
| 60 | SerializedVarOutParam exception, |
| 61 | bool* result); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 62 | void OnMsgHasMethod(int64_t ppp_class, |
| 63 | int64_t object, |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 64 | SerializedVarReceiveInput property, |
| 65 | SerializedVarOutParam exception, |
| 66 | bool* result); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 67 | void OnMsgGetProperty(int64_t ppp_class, |
| 68 | int64_t object, |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 69 | SerializedVarReceiveInput property, |
| 70 | SerializedVarOutParam exception, |
| 71 | SerializedVarReturnValue result); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 72 | 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] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 78 | SerializedVarReceiveInput property, |
| 79 | SerializedVarReceiveInput value, |
| 80 | SerializedVarOutParam exception); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 81 | void OnMsgRemoveProperty(int64_t ppp_class, |
| 82 | int64_t object, |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 83 | SerializedVarReceiveInput property, |
| 84 | SerializedVarOutParam exception); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 85 | void OnMsgCall(int64_t ppp_class, |
| 86 | int64_t object, |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 87 | SerializedVarReceiveInput method_name, |
| 88 | SerializedVarVectorReceiveInput arg_vector, |
| 89 | SerializedVarOutParam exception, |
| 90 | SerializedVarReturnValue result); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 91 | void OnMsgConstruct(int64_t ppp_class, |
| 92 | int64_t object, |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 93 | SerializedVarVectorReceiveInput arg_vector, |
| 94 | SerializedVarOutParam exception, |
| 95 | SerializedVarReturnValue result); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 96 | void OnMsgDeallocate(int64_t ppp_class, int64_t object); |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 97 | |
[email protected] | edb5b05 | 2012-06-18 19:41:30 | [diff] [blame] | 98 | // 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. |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 100 | bool ValidateUserData(int64_t ppp_class, |
| 101 | int64_t class_data, |
[email protected] | edb5b05 | 2012-06-18 19:41:30 | [diff] [blame] | 102 | SerializedVarOutParam* exception); |
| 103 | |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 104 | DISALLOW_COPY_AND_ASSIGN(PPP_Class_Proxy); |
| 105 | }; |
| 106 | |
| 107 | } // namespace proxy |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 108 | } // namespace ppapi |
[email protected] | f6b8a8d | 2010-11-05 22:13:39 | [diff] [blame] | 109 | |
| 110 | #endif // PPAPI_PROXY_PPP_CLASS_PROXY_H_ |