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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return PP_OK_COMPLETIONPENDING; | 70 return PP_OK_COMPLETIONPENDING; |
71 } | 71 } |
72 | 72 |
73 void FlashMenu::ShowACK(int32_t selected_id, int32_t result) { | 73 void FlashMenu::ShowACK(int32_t selected_id, int32_t result) { |
74 *selected_id_ptr_ = selected_id; | 74 *selected_id_ptr_ = selected_id; |
75 PP_RunAndClearCompletionCallback(&callback_, result); | 75 PP_RunAndClearCompletionCallback(&callback_, result); |
76 } | 76 } |
77 | 77 |
78 namespace { | 78 namespace { |
79 | 79 |
80 InterfaceProxy* CreateFlashMenuProxy(Dispatcher* dispatcher) { | 80 InterfaceProxy* CreateFlashMenuProxy(Dispatcher* dispatcher, |
81 return new PPB_Flash_Menu_Proxy(dispatcher); | 81 const void* target_interface) { |
| 82 return new PPB_Flash_Menu_Proxy(dispatcher, target_interface); |
82 } | 83 } |
83 | 84 |
84 } // namespace | 85 } // namespace |
85 | 86 |
86 PPB_Flash_Menu_Proxy::PPB_Flash_Menu_Proxy(Dispatcher* dispatcher) | 87 PPB_Flash_Menu_Proxy::PPB_Flash_Menu_Proxy(Dispatcher* dispatcher, |
87 : InterfaceProxy(dispatcher), | 88 const void* target_interface) |
| 89 : InterfaceProxy(dispatcher, target_interface), |
88 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 90 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
89 } | 91 } |
90 | 92 |
91 PPB_Flash_Menu_Proxy::~PPB_Flash_Menu_Proxy() { | 93 PPB_Flash_Menu_Proxy::~PPB_Flash_Menu_Proxy() { |
92 } | 94 } |
93 | 95 |
94 // static | 96 // static |
95 const InterfaceProxy::Info* PPB_Flash_Menu_Proxy::GetInfo() { | 97 const InterfaceProxy::Info* PPB_Flash_Menu_Proxy::GetInfo() { |
96 static const Info info = { | 98 static const Info info = { |
97 ppapi::thunk::GetPPB_Flash_Menu_Thunk(), | 99 ppapi::thunk::GetPPB_Flash_Menu_Thunk(), |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 OnMsgShowACK) | 137 OnMsgShowACK) |
136 IPC_MESSAGE_UNHANDLED(handled = false) | 138 IPC_MESSAGE_UNHANDLED(handled = false) |
137 IPC_END_MESSAGE_MAP() | 139 IPC_END_MESSAGE_MAP() |
138 // FIXME(brettw) handle bad messages! | 140 // FIXME(brettw) handle bad messages! |
139 return handled; | 141 return handled; |
140 } | 142 } |
141 | 143 |
142 void PPB_Flash_Menu_Proxy::OnMsgCreate(PP_Instance instance, | 144 void PPB_Flash_Menu_Proxy::OnMsgCreate(PP_Instance instance, |
143 const SerializedFlashMenu& menu_data, | 145 const SerializedFlashMenu& menu_data, |
144 HostResource* result) { | 146 HostResource* result) { |
145 thunk::EnterResourceCreation enter(instance); | 147 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true); |
146 if (enter.succeeded()) { | 148 if (enter.succeeded()) { |
147 result->SetHostResource( | 149 result->SetHostResource( |
148 instance, | 150 instance, |
149 enter.functions()->CreateFlashMenu(instance, menu_data.pp_menu())); | 151 enter.functions()->CreateFlashMenu(instance, menu_data.pp_menu())); |
150 } | 152 } |
151 } | 153 } |
152 | 154 |
153 struct PPB_Flash_Menu_Proxy::ShowRequest { | 155 struct PPB_Flash_Menu_Proxy::ShowRequest { |
154 HostResource menu; | 156 HostResource menu; |
155 int32_t selected_id; | 157 int32_t selected_id; |
(...skipping 28 matching lines...) Expand all Loading... |
184 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( | 186 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( |
185 INTERFACE_ID_PPB_FLASH_MENU, | 187 INTERFACE_ID_PPB_FLASH_MENU, |
186 request->menu, | 188 request->menu, |
187 request->selected_id, | 189 request->selected_id, |
188 result)); | 190 result)); |
189 delete request; | 191 delete request; |
190 } | 192 } |
191 | 193 |
192 } // namespace proxy | 194 } // namespace proxy |
193 } // namespace ppapi | 195 } // namespace ppapi |
OLD | NEW |