OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FLASH_MENU_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FLASH_MENU_IMPL_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/ref_counted.h" |
| 12 #include "ppapi/c/pp_point.h" |
| 13 #include "ppapi/c/private/ppb_flash_menu.h" |
| 14 #include "webkit/plugins/ppapi/callbacks.h" |
| 15 #include "webkit/plugins/ppapi/resource.h" |
| 16 |
| 17 struct WebMenuItem; |
| 18 |
| 19 namespace webkit { |
| 20 namespace ppapi { |
| 21 |
| 22 class PPB_Flash_Menu_Impl : public Resource { |
| 23 public: |
| 24 explicit PPB_Flash_Menu_Impl(PluginInstance* instance); |
| 25 virtual ~PPB_Flash_Menu_Impl(); |
| 26 |
| 27 static const PPB_Flash_Menu* GetInterface(); |
| 28 |
| 29 bool Init(const PP_Flash_Menu* menu_data); |
| 30 |
| 31 // Resource override. |
| 32 virtual PPB_Flash_Menu_Impl* AsPPB_Flash_Menu_Impl(); |
| 33 |
| 34 // PPB_Flash_Menu implementation. |
| 35 int32_t Show(const PP_Point* location, |
| 36 int32_t* selected_id_out, |
| 37 PP_CompletionCallback callback); |
| 38 |
| 39 // Called to complete |Show()|. |
| 40 void CompleteShow(int32_t result, unsigned action); |
| 41 |
| 42 typedef std::vector<WebMenuItem> MenuData; |
| 43 const MenuData& menu_data() const { return menu_data_; } |
| 44 |
| 45 private: |
| 46 MenuData menu_data_; |
| 47 |
| 48 // We send |WebMenuItem|s, which have an |unsigned| "action" field instead of |
| 49 // an |int32_t| ID. (Chrome also limits the range of valid values for |
| 50 // actions.) This maps actions to IDs. |
| 51 std::vector<int32_t> menu_id_map_; |
| 52 |
| 53 // Any pending callback (for |Show()|). |
| 54 scoped_refptr<TrackedCompletionCallback> callback_; |
| 55 |
| 56 // Output buffers to be filled in when the callback is completed successfully. |
| 57 int32_t* selected_id_out_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Menu_Impl); |
| 60 }; |
| 61 |
| 62 } // namespace ppapi |
| 63 } // namespace webkit |
| 64 |
| 65 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FLASH_MENU_IMPL_H_ |
OLD | NEW |