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 #include "ppapi/cpp/private/flash_menu.h" 6 7 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/instance_handle.h" 10 #include "ppapi/cpp/module.h" 11 #include "ppapi/cpp/module_impl.h" 12 #include "ppapi/cpp/point.h" 13 14 namespace pp { 15 16 namespace { 17 18 template <> const char* interface_name<PPB_Flash_Menu>() { 19 return PPB_FLASH_MENU_INTERFACE; 20 } 21 22 } // namespace 23 24 namespace flash { 25 26 Menu::Menu(const InstanceHandle& instance, 27 const struct PP_Flash_Menu* menu_data) { 28 if (has_interface<PPB_Flash_Menu>()) { 29 PassRefFromConstructor(get_interface<PPB_Flash_Menu>()->Create( 30 instance.pp_instance(), menu_data)); 31 } 32 } 33 34 int32_t Menu::Show(const Point& location, 35 int32_t* selected_id, 36 const CompletionCallback& cc) { 37 if (!has_interface<PPB_Flash_Menu>()) 38 return cc.MayForce(PP_ERROR_NOINTERFACE); 39 return get_interface<PPB_Flash_Menu>()->Show( 40 pp_resource(), 41 &location.pp_point(), 42 selected_id, 43 cc.pp_completion_callback()); 44 } 45 46 } // namespace flash 47 } // namespace pp 48