blob: de10f80e062fbb20eaaedd42eb22d602b1d399c0 [file] [log] [blame]
[email protected]f24448db2011-01-27 20:40:391// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]4c2e9352010-11-05 22:13:022// 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_INSTANCE_PROXY_H_
6#define PPAPI_PROXY_PPB_INSTANCE_PROXY_H_
7
8#include "ppapi/c/pp_instance.h"
9#include "ppapi/c/pp_resource.h"
10#include "ppapi/c/pp_var.h"
[email protected]0f41c012011-10-21 19:49:2011#include "ppapi/cpp/completion_callback.h"
[email protected]4c2e9352010-11-05 22:13:0212#include "ppapi/proxy/interface_proxy.h"
[email protected]0f41c012011-10-21 19:49:2013#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
[email protected]ceadc392011-06-15 23:04:2414#include "ppapi/shared_impl/function_group_base.h"
[email protected]be0a84b2011-08-13 04:18:4415#include "ppapi/shared_impl/host_resource.h"
[email protected]9a578392011-12-07 18:59:2716#include "ppapi/shared_impl/ppb_instance_shared.h"
[email protected]ceadc392011-06-15 23:04:2417#include "ppapi/thunk/ppb_instance_api.h"
[email protected]4c2e9352010-11-05 22:13:0218
[email protected]0f41c012011-10-21 19:49:2019// Windows headers interfere with this file.
20#ifdef PostMessage
21#undef PostMessage
22#endif
23
[email protected]4d2efd22011-08-18 21:58:0224namespace ppapi {
[email protected]4c2e9352010-11-05 22:13:0225namespace proxy {
26
27class SerializedVarReceiveInput;
28class SerializedVarOutParam;
29class SerializedVarReturnValue;
30
[email protected]ceadc392011-06-15 23:04:2431class PPB_Instance_Proxy : public InterfaceProxy,
[email protected]9a578392011-12-07 18:59:2732 public PPB_Instance_Shared,
33 public thunk::PPB_Instance_FunctionAPI {
[email protected]4c2e9352010-11-05 22:13:0234 public:
[email protected]5c966022011-09-13 18:09:3735 PPB_Instance_Proxy(Dispatcher* dispatcher);
[email protected]4c2e9352010-11-05 22:13:0236 virtual ~PPB_Instance_Proxy();
37
[email protected]ceadc392011-06-15 23:04:2438 static const Info* GetInfoPrivate();
[email protected]4c2e9352010-11-05 22:13:0239
40 // InterfaceProxy implementation.
[email protected]a95986a82010-12-24 06:19:2841 virtual bool OnMessageReceived(const IPC::Message& msg);
[email protected]4c2e9352010-11-05 22:13:0242
[email protected]ceadc392011-06-15 23:04:2443 // FunctionGroupBase overrides.
44 ppapi::thunk::PPB_Instance_FunctionAPI* AsPPB_Instance_FunctionAPI() OVERRIDE;
45
46 // PPB_Instance_FunctionAPI implementation.
47 virtual PP_Bool BindGraphics(PP_Instance instance,
48 PP_Resource device) OVERRIDE;
49 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
[email protected]e8f07ac2012-01-03 17:43:3650 virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
[email protected]ceadc392011-06-15 23:04:2451 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
52 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
53 virtual PP_Var ExecuteScript(PP_Instance instance,
54 PP_Var script,
55 PP_Var* exception) OVERRIDE;
[email protected]8d770e492011-10-11 04:54:3156 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE;
[email protected]5c966022011-09-13 18:09:3757 virtual void Log(PP_Instance instance,
58 int log_level,
59 PP_Var value) OVERRIDE;
60 virtual void LogWithSource(PP_Instance instance,
61 int log_level,
62 PP_Var source,
63 PP_Var value) OVERRIDE;
[email protected]59cf7022011-09-14 22:44:1964 virtual void NumberOfFindResultsChanged(PP_Instance instance,
65 int32_t total,
66 PP_Bool final_result) OVERRIDE;
67 virtual void SelectedFindResultChanged(PP_Instance instance,
68 int32_t index) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3069 virtual PP_Bool SetFullscreen(PP_Instance instance,
70 PP_Bool fullscreen) OVERRIDE;
71 virtual PP_Bool GetScreenSize(PP_Instance instance,
72 PP_Size* size) OVERRIDE;
[email protected]dafab752011-09-20 20:08:4073 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
74 virtual PP_Bool FlashSetFullscreen(PP_Instance instance,
[email protected]06e0a342011-09-27 04:24:3075 PP_Bool fullscreen) OVERRIDE;
76 virtual PP_Bool FlashGetScreenSize(PP_Instance instance, PP_Size* size)
77 OVERRIDE;
[email protected]493d14212011-07-07 15:38:4878 virtual int32_t RequestInputEvents(PP_Instance instance,
79 uint32_t event_classes) OVERRIDE;
80 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
81 uint32_t event_classes) OVERRIDE;
82 virtual void ClearInputEventRequest(PP_Instance instance,
83 uint32_t event_classes) OVERRIDE;
[email protected]55a5a522011-07-06 22:52:4084 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
85 virtual void ZoomLimitsChanged(PP_Instance instance,
86 double minimum_factor,
87 double maximium_factor) OVERRIDE;
[email protected]03460232011-10-10 17:23:5788 virtual PP_Var ResolveRelativeToDocument(
89 PP_Instance instance,
90 PP_Var relative,
91 PP_URLComponents_Dev* components) OVERRIDE;
92 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE;
93 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
94 PP_Instance target) OVERRIDE;
95 virtual PP_Var GetDocumentURL(PP_Instance instance,
96 PP_URLComponents_Dev* components) OVERRIDE;
97 virtual PP_Var GetPluginInstanceURL(
98 PP_Instance instance,
99 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]55a5a522011-07-06 22:52:40100 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
[email protected]18d871f2011-09-08 16:56:34101 virtual int32_t LockMouse(PP_Instance instance,
102 PP_CompletionCallback callback) OVERRIDE;
103 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
[email protected]ceadc392011-06-15 23:04:24104
[email protected]ac4b54d2011-10-20 23:09:28105 static const ApiID kApiID = API_ID_PPB_INSTANCE;
[email protected]5c966022011-09-13 18:09:37106
[email protected]4c2e9352010-11-05 22:13:02107 private:
[email protected]0f41c012011-10-21 19:49:20108 // Plugin -> Host message handlers.
[email protected]e8f07ac2012-01-03 17:43:36109 void OnHostMsgGetWindowObject(PP_Instance instance,
110 SerializedVarReturnValue result);
111 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
[email protected]03460232011-10-10 17:23:57112 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36113 void OnHostMsgBindGraphics(PP_Instance instance,
114 const ppapi::HostResource& device,
115 PP_Bool* result);
116 void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
117 void OnHostMsgExecuteScript(PP_Instance instance,
118 SerializedVarReceiveInput script,
119 SerializedVarOutParam out_exception,
120 SerializedVarReturnValue result);
121 void OnHostMsgGetDefaultCharSet(PP_Instance instance,
122 SerializedVarReturnValue result);
123 void OnHostMsgLog(PP_Instance instance,
124 int log_level,
125 SerializedVarReceiveInput value);
126 void OnHostMsgLogWithSource(PP_Instance instance,
127 int log_level,
128 SerializedVarReceiveInput source,
129 SerializedVarReceiveInput value);
130 void OnHostMsgSetFullscreen(PP_Instance instance,
131 PP_Bool fullscreen,
132 PP_Bool* result);
133 void OnHostMsgGetScreenSize(PP_Instance instance,
134 PP_Bool* result,
135 PP_Size* size);
136 void OnHostMsgFlashSetFullscreen(PP_Instance instance,
137 PP_Bool fullscreen,
138 PP_Bool* result);
139 void OnHostMsgFlashGetScreenSize(PP_Instance instance,
140 PP_Bool* result,
141 PP_Size* size);
142 void OnHostMsgRequestInputEvents(PP_Instance instance,
143 bool is_filtering,
144 uint32_t event_classes);
145 void OnHostMsgClearInputEvents(PP_Instance instance,
146 uint32_t event_classes);
147 void OnHostMsgPostMessage(PP_Instance instance,
148 SerializedVarReceiveInput message);
149 void OnHostMsgLockMouse(PP_Instance instance);
150 void OnHostMsgUnlockMouse(PP_Instance instance);
151 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
152 SerializedVarReceiveInput relative,
153 SerializedVarReturnValue result);
154 void OnHostMsgDocumentCanRequest(PP_Instance instance,
155 SerializedVarReceiveInput url,
156 PP_Bool* result);
157 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
158 PP_Instance target,
159 PP_Bool* result);
160 void OnHostMsgGetDocumentURL(PP_Instance instance,
161 SerializedVarReturnValue result);
162 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
163 SerializedVarReturnValue result);
[email protected]0f41c012011-10-21 19:49:20164
165 // Host -> Plugin message handlers.
[email protected]e8f07ac2012-01-03 17:43:36166 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
[email protected]0f41c012011-10-21 19:49:20167
168 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
169
170 pp::CompletionCallbackFactory<PPB_Instance_Proxy,
171 ProxyNonThreadSafeRefCount> callback_factory_;
[email protected]4c2e9352010-11-05 22:13:02172};
173
174} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02175} // namespace ppapi
[email protected]4c2e9352010-11-05 22:13:02176
177#endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_