Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: webkit/plugins/ppapi/ppb_flash_menu_impl.cc

Issue 7149026: Implement flash menu and net connector resources using the API/thunk model. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_menu_impl.h ('k') | webkit/plugins/ppapi/ppb_flash_net_connector_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_flash_menu_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_flash_menu_impl.cc (revision 89119)
+++ webkit/plugins/ppapi/ppb_flash_menu_impl.cc (working copy)
@@ -13,45 +13,13 @@
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+using ::ppapi::thunk::PPB_Flash_Menu_API;
+
namespace webkit {
namespace ppapi {
namespace {
-PP_Resource Create(PP_Instance instance_id, const PP_Flash_Menu* menu_data) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance)
- return 0;
-
- scoped_refptr<PPB_Flash_Menu_Impl> menu(new PPB_Flash_Menu_Impl(instance));
- if (!menu->Init(menu_data))
- return 0;
-
- return menu->GetReference();
-}
-
-PP_Bool IsFlashMenu(PP_Resource resource) {
- return BoolToPPBool(!!Resource::GetAs<PPB_Flash_Menu_Impl>(resource));
-}
-
-int32_t Show(PP_Resource menu_id,
- const PP_Point* location,
- int32_t* selected_id,
- PP_CompletionCallback callback) {
- scoped_refptr<PPB_Flash_Menu_Impl> menu(
- Resource::GetAs<PPB_Flash_Menu_Impl>(menu_id));
- if (!menu.get())
- return PP_ERROR_BADRESOURCE;
-
- return menu->Show(location, selected_id, callback);
-}
-
-const PPB_Flash_Menu ppb_flash_menu = {
- &Create,
- &IsFlashMenu,
- &Show,
-};
-
// Maximum depth of submenus allowed (e.g., 1 indicates that submenus are
// allowed, but not sub-submenus).
const size_t kMaxMenuDepth = 2;
@@ -130,6 +98,23 @@
: Resource(instance) {
}
+PPB_Flash_Menu_Impl::~PPB_Flash_Menu_Impl() {
+}
+
+// static
+PP_Resource PPB_Flash_Menu_Impl::Create(PP_Instance pp_instance,
+ const PP_Flash_Menu* menu_data) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
+ if (!instance)
+ return 0;
+
+ scoped_refptr<PPB_Flash_Menu_Impl> menu(new PPB_Flash_Menu_Impl(instance));
+ if (!menu->Init(menu_data))
+ return 0;
+
+ return menu->GetReference();
+}
+
bool PPB_Flash_Menu_Impl::Init(const PP_Flash_Menu* menu_data) {
menu_id_map_.clear();
menu_id_map_.push_back(0); // Reserve |menu_id_map_[0]|.
@@ -141,15 +126,7 @@
return true;
}
-PPB_Flash_Menu_Impl::~PPB_Flash_Menu_Impl() {
-}
-
-// static
-const PPB_Flash_Menu* PPB_Flash_Menu_Impl::GetInterface() {
- return &ppb_flash_menu;
-}
-
-PPB_Flash_Menu_Impl* PPB_Flash_Menu_Impl::AsPPB_Flash_Menu_Impl() {
+PPB_Flash_Menu_API* PPB_Flash_Menu_Impl::AsPPB_Flash_Menu_API() {
return this;
}
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_menu_impl.h ('k') | webkit/plugins/ppapi/ppb_flash_net_connector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698