OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_flash_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_proxy.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg) | 79 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg) |
80 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop, | 80 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop, |
81 OnHostMsgSetInstanceAlwaysOnTop) | 81 OnHostMsgSetInstanceAlwaysOnTop) |
82 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, | 82 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, |
83 OnHostMsgDrawGlyphs) | 83 OnHostMsgDrawGlyphs) |
84 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) | 84 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) |
85 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, | 85 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, |
86 OnHostMsgIsRectTopmost) | 86 OnHostMsgIsRectTopmost) |
87 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, | 87 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, |
88 OnHostMsgInvokePrinting) | 88 OnHostMsgInvokePrinting) |
89 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, | |
90 OnHostMsgGetSetting) | |
91 IPC_MESSAGE_UNHANDLED(handled = false) | 89 IPC_MESSAGE_UNHANDLED(handled = false) |
92 IPC_END_MESSAGE_MAP() | 90 IPC_END_MESSAGE_MAP() |
93 // TODO(brettw) handle bad messages! | 91 // TODO(brettw) handle bad messages! |
94 return handled; | 92 return handled; |
95 } | 93 } |
96 | 94 |
97 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, | 95 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, |
98 PP_Bool on_top) { | 96 PP_Bool on_top) { |
99 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( | 97 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( |
100 API_ID_PPB_FLASH, instance, on_top)); | 98 API_ID_PPB_FLASH, instance, on_top)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 167 } |
170 | 168 |
171 PP_Bool PPB_Flash_Proxy::IsRectTopmost(PP_Instance instance, | 169 PP_Bool PPB_Flash_Proxy::IsRectTopmost(PP_Instance instance, |
172 const PP_Rect* rect) { | 170 const PP_Rect* rect) { |
173 PP_Bool result = PP_FALSE; | 171 PP_Bool result = PP_FALSE; |
174 dispatcher()->Send(new PpapiHostMsg_PPBFlash_IsRectTopmost( | 172 dispatcher()->Send(new PpapiHostMsg_PPBFlash_IsRectTopmost( |
175 API_ID_PPB_FLASH, instance, *rect, &result)); | 173 API_ID_PPB_FLASH, instance, *rect, &result)); |
176 return result; | 174 return result; |
177 } | 175 } |
178 | 176 |
179 PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance, | |
180 PP_FlashSetting setting) { | |
181 PluginDispatcher* plugin_dispatcher = | |
182 static_cast<PluginDispatcher*>(dispatcher()); | |
183 switch (setting) { | |
184 case PP_FLASHSETTING_3DENABLED: | |
185 return PP_MakeBool(PP_FromBool( | |
186 plugin_dispatcher->preferences().is_3d_supported)); | |
187 case PP_FLASHSETTING_INCOGNITO: | |
188 return PP_MakeBool(PP_FromBool(plugin_dispatcher->incognito())); | |
189 case PP_FLASHSETTING_STAGE3DENABLED: | |
190 return PP_MakeBool(PP_FromBool( | |
191 plugin_dispatcher->preferences().is_stage3d_supported)); | |
192 case PP_FLASHSETTING_LANGUAGE: | |
193 return StringVar::StringToPPVar( | |
194 PluginGlobals::Get()->GetUILanguage()); | |
195 case PP_FLASHSETTING_NUMCORES: | |
196 return PP_MakeInt32(plugin_dispatcher->preferences().number_of_cpu_cores); | |
197 case PP_FLASHSETTING_LSORESTRICTIONS: { | |
198 ReceiveSerializedVarReturnValue result; | |
199 dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetSetting( | |
200 API_ID_PPB_FLASH, instance, setting, &result)); | |
201 return result.Return(dispatcher()); | |
202 } | |
203 } | |
204 return PP_MakeUndefined(); | |
205 } | |
206 | |
207 void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, | 177 void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, |
208 PP_Bool on_top) { | 178 PP_Bool on_top) { |
209 EnterInstanceNoLock enter(instance); | 179 EnterInstanceNoLock enter(instance); |
210 if (enter.succeeded()) | 180 if (enter.succeeded()) |
211 enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); | 181 enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); |
212 } | 182 } |
213 | 183 |
214 void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( | 184 void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( |
215 PP_Instance instance, | 185 PP_Instance instance, |
216 const PPBFlash_DrawGlyphs_Params& params, | 186 const PPBFlash_DrawGlyphs_Params& params, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, | 245 void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, |
276 PP_Rect rect, | 246 PP_Rect rect, |
277 PP_Bool* result) { | 247 PP_Bool* result) { |
278 EnterInstanceNoLock enter(instance); | 248 EnterInstanceNoLock enter(instance); |
279 if (enter.succeeded()) | 249 if (enter.succeeded()) |
280 *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect); | 250 *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect); |
281 else | 251 else |
282 *result = PP_FALSE; | 252 *result = PP_FALSE; |
283 } | 253 } |
284 | 254 |
285 void PPB_Flash_Proxy::OnHostMsgGetSetting(PP_Instance instance, | |
286 PP_FlashSetting setting, | |
287 SerializedVarReturnValue id) { | |
288 EnterInstanceNoLock enter(instance); | |
289 if (enter.succeeded()) { | |
290 id.Return(dispatcher(), | |
291 enter.functions()->GetFlashAPI()->GetSetting( | |
292 instance, setting)); | |
293 } else { | |
294 id.Return(dispatcher(), PP_MakeUndefined()); | |
295 } | |
296 } | |
297 | |
298 void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) { | 255 void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) { |
299 // This function is actually implemented in the PPB_Flash_Print interface. | 256 // This function is actually implemented in the PPB_Flash_Print interface. |
300 // It's rarely used enough that we just request this interface when needed. | 257 // It's rarely used enough that we just request this interface when needed. |
301 const PPB_Flash_Print_1_0* print_interface = | 258 const PPB_Flash_Print_1_0* print_interface = |
302 static_cast<const PPB_Flash_Print_1_0*>( | 259 static_cast<const PPB_Flash_Print_1_0*>( |
303 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); | 260 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); |
304 if (print_interface) | 261 if (print_interface) |
305 print_interface->InvokePrinting(instance); | 262 print_interface->InvokePrinting(instance); |
306 } | 263 } |
307 | 264 |
308 } // namespace proxy | 265 } // namespace proxy |
309 } // namespace ppapi | 266 } // namespace ppapi |
OLD | NEW |