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