OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/proxy/ppb_instance_proxy.h" | 5 #include "ppapi/proxy/ppb_instance_proxy.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_fullscreen_dev.h" | 7 #include "ppapi/c/dev/ppb_fullscreen_dev.h" |
8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
| 9 #include "ppapi/c/ppb_fullscreen.h" |
9 #include "ppapi/c/ppb_instance.h" | 10 #include "ppapi/c/ppb_instance.h" |
10 #include "ppapi/c/ppb_messaging.h" | 11 #include "ppapi/c/ppb_messaging.h" |
11 #include "ppapi/proxy/host_dispatcher.h" | 12 #include "ppapi/proxy/host_dispatcher.h" |
12 #include "ppapi/proxy/plugin_dispatcher.h" | 13 #include "ppapi/proxy/plugin_dispatcher.h" |
13 #include "ppapi/proxy/plugin_resource_tracker.h" | 14 #include "ppapi/proxy/plugin_resource_tracker.h" |
14 #include "ppapi/proxy/ppapi_messages.h" | 15 #include "ppapi/proxy/ppapi_messages.h" |
15 #include "ppapi/proxy/serialized_var.h" | 16 #include "ppapi/proxy/serialized_var.h" |
16 #include "ppapi/thunk/enter.h" | 17 #include "ppapi/thunk/enter.h" |
17 #include "ppapi/thunk/thunk.h" | 18 #include "ppapi/thunk/thunk.h" |
18 | 19 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 false, | 91 false, |
91 &CreateInstanceProxy, | 92 &CreateInstanceProxy, |
92 }; | 93 }; |
93 return &info; | 94 return &info; |
94 } | 95 } |
95 | 96 |
96 // static | 97 // static |
97 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoFullscreen() { | 98 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoFullscreen() { |
98 static const Info info = { | 99 static const Info info = { |
99 ppapi::thunk::GetPPB_Fullscreen_Thunk(), | 100 ppapi::thunk::GetPPB_Fullscreen_Thunk(), |
| 101 PPB_FULLSCREEN_INTERFACE, |
| 102 INTERFACE_ID_NONE, // 1_0 is the canonical one. |
| 103 false, |
| 104 &CreateInstanceProxy, |
| 105 }; |
| 106 return &info; |
| 107 } |
| 108 |
| 109 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoFullscreen_Dev() { |
| 110 static const Info info = { |
| 111 ppapi::thunk::GetPPB_Fullscreen_Dev_Thunk(), |
100 PPB_FULLSCREEN_DEV_INTERFACE, | 112 PPB_FULLSCREEN_DEV_INTERFACE, |
101 INTERFACE_ID_NONE, // 1_0 is the canonical one. | 113 INTERFACE_ID_NONE, // 1_0 is the canonical one. |
102 false, | 114 false, |
103 &CreateInstanceProxy, | 115 &CreateInstanceProxy, |
104 }; | 116 }; |
105 return &info; | 117 return &info; |
106 } | 118 } |
107 | 119 |
108 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { | 120 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { |
109 // Prevent the dispatcher from going away during a call to ExecuteScript. | 121 // Prevent the dispatcher from going away during a call to ExecuteScript. |
(...skipping 11 matching lines...) Expand all Loading... |
121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, | 133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, |
122 OnMsgBindGraphics) | 134 OnMsgBindGraphics) |
123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, | 135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, |
124 OnMsgIsFullFrame) | 136 OnMsgIsFullFrame) |
125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, | 137 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, |
126 OnMsgExecuteScript) | 138 OnMsgExecuteScript) |
127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, | 139 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, |
128 OnMsgPostMessage) | 140 OnMsgPostMessage) |
129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, | 141 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, |
130 OnMsgSetFullscreen) | 142 OnMsgSetFullscreen) |
| 143 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen_Dev, |
| 144 OnMsgSetFullscreen_Dev) |
131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, | 145 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, |
132 OnMsgGetScreenSize) | 146 OnMsgGetScreenSize) |
| 147 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize_Dev, |
| 148 OnMsgGetScreenSize_Dev) |
133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, | 149 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, |
134 OnMsgRequestInputEvents) | 150 OnMsgRequestInputEvents) |
135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, | 151 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, |
136 OnMsgClearInputEvents) | 152 OnMsgClearInputEvents) |
137 IPC_MESSAGE_UNHANDLED(handled = false) | 153 IPC_MESSAGE_UNHANDLED(handled = false) |
138 IPC_END_MESSAGE_MAP() | 154 IPC_END_MESSAGE_MAP() |
139 return handled; | 155 return handled; |
140 } | 156 } |
141 | 157 |
142 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() { | 158 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 208 } |
193 | 209 |
194 PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) { | 210 PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) { |
195 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 211 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
196 GetInstanceData(instance); | 212 GetInstanceData(instance); |
197 if (!data) | 213 if (!data) |
198 return PP_FALSE; | 214 return PP_FALSE; |
199 return data->fullscreen; | 215 return data->fullscreen; |
200 } | 216 } |
201 | 217 |
| 218 PP_Bool PPB_Instance_Proxy::IsFullscreen_Dev(PP_Instance instance) { |
| 219 return IsFullscreen(instance); |
| 220 } |
| 221 |
202 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, | 222 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, |
203 PP_Bool fullscreen) { | 223 PP_Bool fullscreen) { |
204 PP_Bool result = PP_FALSE; | 224 PP_Bool result = PP_FALSE; |
205 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( | 225 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( |
206 INTERFACE_ID_PPB_INSTANCE, instance, fullscreen, &result)); | 226 INTERFACE_ID_PPB_INSTANCE, instance, fullscreen, &result)); |
207 return result; | 227 return result; |
208 } | 228 } |
209 | 229 |
| 230 PP_Bool PPB_Instance_Proxy::SetFullscreen_Dev(PP_Instance instance, |
| 231 PP_Bool fullscreen) { |
| 232 PP_Bool result = PP_FALSE; |
| 233 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen_Dev( |
| 234 INTERFACE_ID_PPB_INSTANCE, instance, fullscreen, &result)); |
| 235 return result; |
| 236 } |
| 237 |
210 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance, | 238 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance, |
211 PP_Size* size) { | 239 PP_Size* size) { |
212 PP_Bool result = PP_FALSE; | 240 PP_Bool result = PP_FALSE; |
213 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( | 241 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( |
214 INTERFACE_ID_PPB_INSTANCE, instance, &result, size)); | 242 INTERFACE_ID_PPB_INSTANCE, instance, &result, size)); |
215 return result; | 243 return result; |
216 } | 244 } |
217 | 245 |
| 246 PP_Bool PPB_Instance_Proxy::GetScreenSize_Dev(PP_Instance instance, |
| 247 PP_Size* size) { |
| 248 PP_Bool result = PP_FALSE; |
| 249 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize_Dev( |
| 250 INTERFACE_ID_PPB_INSTANCE, instance, &result, size)); |
| 251 return result; |
| 252 } |
| 253 |
218 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance, | 254 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance, |
219 uint32_t event_classes) { | 255 uint32_t event_classes) { |
220 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( | 256 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( |
221 INTERFACE_ID_PPB_INSTANCE, instance, false, event_classes)); | 257 INTERFACE_ID_PPB_INSTANCE, instance, false, event_classes)); |
222 | 258 |
223 // We always register for the classes we can handle, this function validates | 259 // We always register for the classes we can handle, this function validates |
224 // the flags so we can notify it if anything was invalid, without requiring | 260 // the flags so we can notify it if anything was invalid, without requiring |
225 // a sync reply. | 261 // a sync reply. |
226 return ValidateRequestInputEvents(false, event_classes); | 262 return ValidateRequestInputEvents(false, event_classes); |
227 } | 263 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 361 } |
326 | 362 |
327 void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance, | 363 void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance, |
328 PP_Bool fullscreen, | 364 PP_Bool fullscreen, |
329 PP_Bool* result) { | 365 PP_Bool* result) { |
330 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 366 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
331 if (enter.succeeded()) | 367 if (enter.succeeded()) |
332 *result = enter.functions()->SetFullscreen(instance, fullscreen); | 368 *result = enter.functions()->SetFullscreen(instance, fullscreen); |
333 } | 369 } |
334 | 370 |
| 371 void PPB_Instance_Proxy::OnMsgSetFullscreen_Dev(PP_Instance instance, |
| 372 PP_Bool fullscreen, |
| 373 PP_Bool* result) { |
| 374 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
| 375 if (enter.succeeded()) |
| 376 *result = enter.functions()->SetFullscreen_Dev(instance, fullscreen); |
| 377 } |
| 378 |
335 void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance, | 379 void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance, |
336 PP_Bool* result, | 380 PP_Bool* result, |
337 PP_Size* size) { | 381 PP_Size* size) { |
338 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 382 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
339 if (enter.succeeded()) | 383 if (enter.succeeded()) |
340 *result = enter.functions()->GetScreenSize(instance, size); | 384 *result = enter.functions()->GetScreenSize(instance, size); |
341 } | 385 } |
342 | 386 |
| 387 void PPB_Instance_Proxy::OnMsgGetScreenSize_Dev(PP_Instance instance, |
| 388 PP_Bool* result, |
| 389 PP_Size* size) { |
| 390 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
| 391 if (enter.succeeded()) |
| 392 *result = enter.functions()->GetScreenSize_Dev(instance, size); |
| 393 } |
| 394 |
343 void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance, | 395 void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance, |
344 bool is_filtering, | 396 bool is_filtering, |
345 uint32_t event_classes) { | 397 uint32_t event_classes) { |
346 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 398 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
347 if (enter.succeeded()) { | 399 if (enter.succeeded()) { |
348 if (is_filtering) | 400 if (is_filtering) |
349 enter.functions()->RequestFilteringInputEvents(instance, event_classes); | 401 enter.functions()->RequestFilteringInputEvents(instance, event_classes); |
350 else | 402 else |
351 enter.functions()->RequestInputEvents(instance, event_classes); | 403 enter.functions()->RequestInputEvents(instance, event_classes); |
352 } | 404 } |
353 } | 405 } |
354 | 406 |
355 void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance, | 407 void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance, |
356 uint32_t event_classes) { | 408 uint32_t event_classes) { |
357 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 409 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
358 if (enter.succeeded()) | 410 if (enter.succeeded()) |
359 enter.functions()->ClearInputEventRequest(instance, event_classes); | 411 enter.functions()->ClearInputEventRequest(instance, event_classes); |
360 } | 412 } |
361 | 413 |
362 void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance, | 414 void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance, |
363 SerializedVarReceiveInput message) { | 415 SerializedVarReceiveInput message) { |
364 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 416 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
365 if (enter.succeeded()) | 417 if (enter.succeeded()) |
366 enter.functions()->PostMessage(instance, message.Get(dispatcher())); | 418 enter.functions()->PostMessage(instance, message.Get(dispatcher())); |
367 } | 419 } |
368 | 420 |
369 } // namespace proxy | 421 } // namespace proxy |
370 } // namespace ppapi | 422 } // namespace ppapi |
OLD | NEW |