Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: ppapi/proxy/ppb_flash_proxy.cc

Issue 6432001: Implement proxy for FlashMenu and Run/QuitMessageLoop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle NULL menus more gracefully Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.h ('k') | ppapi/proxy/ppb_testing_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_flash_proxy.h" 5 #include "ppapi/proxy/ppb_flash_proxy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 #include "ppapi/c/dev/pp_file_info_dev.h" 10 #include "ppapi/c/dev/pp_file_info_dev.h"
10 #include "ppapi/c/dev/ppb_font_dev.h" 11 #include "ppapi/c/dev/ppb_font_dev.h"
11 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_errors.h" 13 #include "ppapi/c/pp_errors.h"
13 #include "ppapi/c/pp_resource.h" 14 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/private/ppb_flash.h" 15 #include "ppapi/c/private/ppb_flash.h"
15 #include "ppapi/proxy/plugin_dispatcher.h" 16 #include "ppapi/proxy/plugin_dispatcher.h"
16 #include "ppapi/proxy/plugin_resource.h" 17 #include "ppapi/proxy/plugin_resource.h"
17 #include "ppapi/proxy/ppapi_messages.h" 18 #include "ppapi/proxy/ppapi_messages.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 229 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
229 if (!dispatcher) 230 if (!dispatcher)
230 return PP_FALSE; 231 return PP_FALSE;
231 232
232 PP_Bool result = PP_FALSE; 233 PP_Bool result = PP_FALSE;
233 dispatcher->Send(new PpapiHostMsg_PPBFlash_NavigateToURL( 234 dispatcher->Send(new PpapiHostMsg_PPBFlash_NavigateToURL(
234 INTERFACE_ID_PPB_FLASH, instance, url, target, &result)); 235 INTERFACE_ID_PPB_FLASH, instance, url, target, &result));
235 return result; 236 return result;
236 } 237 }
237 238
239 void RunMessageLoop(PP_Instance instance) {
240 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
241 if (!dispatcher)
242 return;
243 IPC::SyncMessage* msg = new PpapiHostMsg_PPBFlash_RunMessageLoop(
244 INTERFACE_ID_PPB_FLASH, instance);
245 msg->EnableMessagePumping();
246 dispatcher->Send(msg);
247 }
248
249 void QuitMessageLoop(PP_Instance instance) {
250 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
251 if (!dispatcher)
252 return;
253 dispatcher->Send(new PpapiHostMsg_PPBFlash_QuitMessageLoop(
254 INTERFACE_ID_PPB_FLASH, instance));
255 }
256
238 const PPB_Flash flash_interface = { 257 const PPB_Flash flash_interface = {
239 &SetInstanceAlwaysOnTop, 258 &SetInstanceAlwaysOnTop,
240 &DrawGlyphs, 259 &DrawGlyphs,
241 &GetProxyForURL, 260 &GetProxyForURL,
242 &OpenModuleLocalFile, 261 &OpenModuleLocalFile,
243 &RenameModuleLocalFile, 262 &RenameModuleLocalFile,
244 &DeleteModuleLocalFileOrDir, 263 &DeleteModuleLocalFileOrDir,
245 &CreateModuleLocalDir, 264 &CreateModuleLocalDir,
246 &QueryModuleLocalFile, 265 &QueryModuleLocalFile,
247 &GetModuleLocalDirContents, 266 &GetModuleLocalDirContents,
248 &FreeModuleLocalDirContents, 267 &FreeModuleLocalDirContents,
249 &NavigateToURL, 268 &NavigateToURL,
269 &RunMessageLoop,
270 &QuitMessageLoop,
250 }; 271 };
251 272
252 InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher, 273 InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher,
253 const void* target_interface) { 274 const void* target_interface) {
254 return new PPB_Flash_Proxy(dispatcher, target_interface); 275 return new PPB_Flash_Proxy(dispatcher, target_interface);
255 } 276 }
256 277
257 } // namespace 278 } // namespace
258 279
259 PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher, 280 PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 OnMsgRenameModuleLocalFile) 312 OnMsgRenameModuleLocalFile)
292 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DeleteModuleLocalFileOrDir, 313 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DeleteModuleLocalFileOrDir,
293 OnMsgDeleteModuleLocalFileOrDir) 314 OnMsgDeleteModuleLocalFileOrDir)
294 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_CreateModuleLocalDir, 315 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_CreateModuleLocalDir,
295 OnMsgCreateModuleLocalDir) 316 OnMsgCreateModuleLocalDir)
296 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryModuleLocalFile, 317 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryModuleLocalFile,
297 OnMsgQueryModuleLocalFile) 318 OnMsgQueryModuleLocalFile)
298 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetModuleLocalDirContents, 319 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetModuleLocalDirContents,
299 OnMsgGetModuleLocalDirContents) 320 OnMsgGetModuleLocalDirContents)
300 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_NavigateToURL, OnMsgNavigateToURL) 321 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_NavigateToURL, OnMsgNavigateToURL)
322 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_RunMessageLoop,
323 OnMsgRunMessageLoop)
324 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop,
325 OnMsgQuitMessageLoop)
301 IPC_MESSAGE_UNHANDLED(handled = false) 326 IPC_MESSAGE_UNHANDLED(handled = false)
302 IPC_END_MESSAGE_MAP() 327 IPC_END_MESSAGE_MAP()
303 // TODO(brettw) handle bad messages! 328 // TODO(brettw) handle bad messages!
304 return handled; 329 return handled;
305 } 330 }
306 331
307 void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop( 332 void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop(
308 PP_Instance instance, 333 PP_Instance instance,
309 PP_Bool on_top) { 334 PP_Bool on_top) {
310 ppb_flash_target()->SetInstanceAlwaysOnTop(instance, on_top); 335 ppb_flash_target()->SetInstanceAlwaysOnTop(instance, on_top);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 432 }
408 433
409 void PPB_Flash_Proxy::OnMsgNavigateToURL(PP_Instance instance, 434 void PPB_Flash_Proxy::OnMsgNavigateToURL(PP_Instance instance,
410 const std::string& url, 435 const std::string& url,
411 const std::string& target, 436 const std::string& target,
412 PP_Bool* result) { 437 PP_Bool* result) {
413 *result = ppb_flash_target()->NavigateToURL(instance, url.c_str(), 438 *result = ppb_flash_target()->NavigateToURL(instance, url.c_str(),
414 target.c_str()); 439 target.c_str());
415 } 440 }
416 441
442 void PPB_Flash_Proxy::OnMsgRunMessageLoop(PP_Instance instance) {
443 ppb_flash_target()->RunMessageLoop(instance);
444 }
445
446 void PPB_Flash_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
447 ppb_flash_target()->QuitMessageLoop(instance);
448 }
449
417 } // namespace proxy 450 } // namespace proxy
418 } // namespace pp 451 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.h ('k') | ppapi/proxy/ppb_testing_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698