| 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_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 13 matching lines...) Expand all Loading... |
| 24 public: | 24 public: |
| 25 explicit FlashMenu(const HostResource& resource); | 25 explicit FlashMenu(const HostResource& resource); |
| 26 virtual ~FlashMenu(); | 26 virtual ~FlashMenu(); |
| 27 | 27 |
| 28 // Resource overrides. | 28 // Resource overrides. |
| 29 virtual PPB_Flash_Menu_API* AsPPB_Flash_Menu_API() OVERRIDE; | 29 virtual PPB_Flash_Menu_API* AsPPB_Flash_Menu_API() OVERRIDE; |
| 30 | 30 |
| 31 // PPB_Flash_Menu_API implementation. | 31 // PPB_Flash_Menu_API implementation. |
| 32 virtual int32_t Show(const PP_Point* location, | 32 virtual int32_t Show(const PP_Point* location, |
| 33 int32_t* selected_id, | 33 int32_t* selected_id, |
| 34 PP_CompletionCallback callback) OVERRIDE; | 34 ApiCallbackType callback) OVERRIDE; |
| 35 | 35 |
| 36 void ShowACK(int32_t selected_id, int32_t result); | 36 void ShowACK(int32_t selected_id, int32_t result); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 scoped_refptr<TrackedCallback> callback_; | 39 scoped_refptr<TrackedCallback> callback_; |
| 40 int32_t* selected_id_ptr_; | 40 int32_t* selected_id_ptr_; |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(FlashMenu); | 42 DISALLOW_COPY_AND_ASSIGN(FlashMenu); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 FlashMenu::FlashMenu(const HostResource& resource) | 45 FlashMenu::FlashMenu(const HostResource& resource) |
| 46 : Resource(OBJECT_IS_PROXY, resource), | 46 : Resource(OBJECT_IS_PROXY, resource), |
| 47 selected_id_ptr_(NULL) { | 47 selected_id_ptr_(NULL) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 FlashMenu::~FlashMenu() { | 50 FlashMenu::~FlashMenu() { |
| 51 } | 51 } |
| 52 | 52 |
| 53 PPB_Flash_Menu_API* FlashMenu::AsPPB_Flash_Menu_API() { | 53 PPB_Flash_Menu_API* FlashMenu::AsPPB_Flash_Menu_API() { |
| 54 return this; | 54 return this; |
| 55 } | 55 } |
| 56 | 56 |
| 57 int32_t FlashMenu::Show(const struct PP_Point* location, | 57 int32_t FlashMenu::Show(const struct PP_Point* location, |
| 58 int32_t* selected_id, | 58 int32_t* selected_id, |
| 59 struct PP_CompletionCallback callback) { | 59 ApiCallbackType callback) { |
| 60 if (TrackedCallback::IsPending(callback_)) | 60 if (TrackedCallback::IsPending(callback_)) |
| 61 return PP_ERROR_INPROGRESS; | 61 return PP_ERROR_INPROGRESS; |
| 62 | 62 |
| 63 selected_id_ptr_ = selected_id; | 63 selected_id_ptr_ = selected_id; |
| 64 callback_ = new TrackedCallback(this, callback); | 64 callback_ = callback; |
| 65 | 65 |
| 66 PluginDispatcher::GetForResource(this)->Send( | 66 PluginDispatcher::GetForResource(this)->Send( |
| 67 new PpapiHostMsg_PPBFlashMenu_Show( | 67 new PpapiHostMsg_PPBFlashMenu_Show( |
| 68 API_ID_PPB_FLASH_MENU, host_resource(), *location)); | 68 API_ID_PPB_FLASH_MENU, host_resource(), *location)); |
| 69 return PP_OK_COMPLETIONPENDING; | 69 return PP_OK_COMPLETIONPENDING; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void FlashMenu::ShowACK(int32_t selected_id, int32_t result) { | 72 void FlashMenu::ShowACK(int32_t selected_id, int32_t result) { |
| 73 *selected_id_ptr_ = selected_id; | 73 *selected_id_ptr_ = selected_id; |
| 74 TrackedCallback::ClearAndRun(&callback_, result); | 74 TrackedCallback::ClearAndRun(&callback_, result); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( | 163 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( |
| 164 API_ID_PPB_FLASH_MENU, | 164 API_ID_PPB_FLASH_MENU, |
| 165 request->menu, | 165 request->menu, |
| 166 request->selected_id, | 166 request->selected_id, |
| 167 result)); | 167 result)); |
| 168 delete request; | 168 delete request; |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace proxy | 171 } // namespace proxy |
| 172 } // namespace ppapi | 172 } // namespace ppapi |
| OLD | NEW |