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_flash_menu_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_menu_proxy.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/private/ppb_flash_menu.h" | 8 #include "ppapi/c/private/ppb_flash_menu.h" |
9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
11 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
12 #include "ppapi/thunk/ppb_flash_menu_api.h" | 12 #include "ppapi/thunk/ppb_flash_menu_api.h" |
13 #include "ppapi/thunk/resource_creation_api.h" | 13 #include "ppapi/thunk/resource_creation_api.h" |
14 #include "ppapi/thunk/thunk.h" | 14 #include "ppapi/thunk/thunk.h" |
15 | 15 |
16 using ppapi::HostResource; | |
17 using ppapi::Resource; | |
18 using ppapi::thunk::EnterFunctionNoLock; | 16 using ppapi::thunk::EnterFunctionNoLock; |
19 using ppapi::thunk::PPB_Flash_Menu_API; | 17 using ppapi::thunk::PPB_Flash_Menu_API; |
20 using ppapi::thunk::ResourceCreationAPI; | 18 using ppapi::thunk::ResourceCreationAPI; |
21 | 19 |
22 namespace pp { | 20 namespace ppapi { |
23 namespace proxy { | 21 namespace proxy { |
24 | 22 |
25 class FlashMenu : public PPB_Flash_Menu_API, public Resource { | 23 class FlashMenu : public PPB_Flash_Menu_API, public Resource { |
26 public: | 24 public: |
27 explicit FlashMenu(const HostResource& resource); | 25 explicit FlashMenu(const HostResource& resource); |
28 virtual ~FlashMenu(); | 26 virtual ~FlashMenu(); |
29 | 27 |
30 // Resource overrides. | 28 // Resource overrides. |
31 virtual PPB_Flash_Menu_API* AsPPB_Flash_Menu_API() OVERRIDE; | 29 virtual PPB_Flash_Menu_API* AsPPB_Flash_Menu_API() OVERRIDE; |
32 | 30 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 107 |
110 // static | 108 // static |
111 PP_Resource PPB_Flash_Menu_Proxy::CreateProxyResource( | 109 PP_Resource PPB_Flash_Menu_Proxy::CreateProxyResource( |
112 PP_Instance instance_id, | 110 PP_Instance instance_id, |
113 const PP_Flash_Menu* menu_data) { | 111 const PP_Flash_Menu* menu_data) { |
114 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); | 112 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); |
115 if (!dispatcher) | 113 if (!dispatcher) |
116 return 0; | 114 return 0; |
117 | 115 |
118 HostResource result; | 116 HostResource result; |
119 pp::proxy::SerializedFlashMenu serialized_menu; | 117 SerializedFlashMenu serialized_menu; |
120 if (!serialized_menu.SetPPMenu(menu_data)) | 118 if (!serialized_menu.SetPPMenu(menu_data)) |
121 return 0; | 119 return 0; |
122 | 120 |
123 dispatcher->Send(new PpapiHostMsg_PPBFlashMenu_Create( | 121 dispatcher->Send(new PpapiHostMsg_PPBFlashMenu_Create( |
124 INTERFACE_ID_PPB_FLASH_MENU, instance_id, serialized_menu, &result)); | 122 INTERFACE_ID_PPB_FLASH_MENU, instance_id, serialized_menu, &result)); |
125 if (result.is_null()) | 123 if (result.is_null()) |
126 return 0; | 124 return 0; |
127 return (new FlashMenu(result))->GetReference(); | 125 return (new FlashMenu(result))->GetReference(); |
128 } | 126 } |
129 | 127 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 ShowRequest* request) { | 185 ShowRequest* request) { |
188 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( | 186 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( |
189 INTERFACE_ID_PPB_FLASH_MENU, | 187 INTERFACE_ID_PPB_FLASH_MENU, |
190 request->menu, | 188 request->menu, |
191 request->selected_id, | 189 request->selected_id, |
192 result)); | 190 result)); |
193 delete request; | 191 delete request; |
194 } | 192 } |
195 | 193 |
196 } // namespace proxy | 194 } // namespace proxy |
197 } // namespace pp | 195 } // namespace ppapi |
OLD | NEW |