summaryrefslogtreecommitdiffstats
path: root/ppapi/c
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 21:41:08 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 21:41:08 +0000
commitb29aa74b75d57e1dc78bb151f1b7b2153d13ae3f (patch)
treec06576af8874b736101b045e4e1d75cfed7ba897 /ppapi/c
parent314e594492cfd5c23225763cb46c5cd190b5551c (diff)
downloadchromium_src-b29aa74b75d57e1dc78bb151f1b7b2153d13ae3f.zip
chromium_src-b29aa74b75d57e1dc78bb151f1b7b2153d13ae3f.tar.gz
chromium_src-b29aa74b75d57e1dc78bb151f1b7b2153d13ae3f.tar.bz2
Pepper/Flapper: First pass at context menu implementation.
This meets the needs of Flapper. We may want to generalize/restrict/modify the API for inclusion into PPAPI, but hopefully this lays a foundation. BUG=none TEST=Flapper context menus work (with the right version of Flapper) Review URL: http://codereview.chromium.org/6253017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r--ppapi/c/pp_errors.h6
-rw-r--r--ppapi/c/private/ppb_flash.h13
-rw-r--r--ppapi/c/private/ppb_flash_menu.h57
3 files changed, 73 insertions, 3 deletions
diff --git a/ppapi/c/pp_errors.h b/ppapi/c/pp_errors.h
index 2d07e90..0138f2f 100644
--- a/ppapi/c/pp_errors.h
+++ b/ppapi/c/pp_errors.h
@@ -75,7 +75,10 @@ enum {
PP_ERROR_FILECHANGED = -23,
/** Indicates failure due to a time limit being exceeded. */
- PP_ERROR_TIMEDOUT = -30
+ PP_ERROR_TIMEDOUT = -30,
+
+ /** Indicates that the user cancelled rather providing expected input. */
+ PP_ERROR_USERCANCEL = -40
};
/**
@@ -84,4 +87,3 @@ enum {
*/
#endif /* PPAPI_C_PP_ERRORS_H_ */
-
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index a7a5bab..3f8f222 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -19,7 +19,7 @@
// PPB_Flash -------------------------------------------------------------------
-#define PPB_FLASH_INTERFACE "PPB_Flash;4"
+#define PPB_FLASH_INTERFACE "PPB_Flash;5"
#ifdef _WIN32
typedef HANDLE PP_FileHandle;
@@ -116,6 +116,17 @@ struct PPB_Flash {
PP_Bool (*NavigateToURL)(PP_Instance instance,
const char* url,
const char* target);
+
+ // Runs a nested message loop. The plugin will be reentered from this call.
+ // This function is used in places where Flash would normally enter a nested
+ // message loop (e.g., when displaying context menus), but Pepper provides
+ // only an asynchronous call. After performing that asynchronous call, call
+ // |RunMessageLoop()|. In the callback, call |QuitMessageLoop()|.
+ void (*RunMessageLoop)();
+
+ // Posts a quit message for the outermost nested message loop. Use this to
+ // exit and return back to the caller after you call RunMessageLoop.
+ void (*QuitMessageLoop)();
};
// PPB_Flash_NetConnector ------------------------------------------------------
diff --git a/ppapi/c/private/ppb_flash_menu.h b/ppapi/c/private/ppb_flash_menu.h
new file mode 100644
index 0000000..a183baf
--- /dev/null
+++ b/ppapi/c/private/ppb_flash_menu.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_
+#define PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_resource.h"
+
+// PPB_Flash -------------------------------------------------------------------
+
+#define PPB_FLASH_MENU_INTERFACE "PPB_Flash_Menu;1"
+
+struct PP_CompletionCallback;
+
+typedef enum {
+ // TODO(viettrungluu): Radio items not supported yet. Will also probably want
+ // special menu items tied to clipboard access.
+ PP_FLASH_MENUITEM_TYPE_NORMAL = 0,
+ PP_FLASH_MENUITEM_TYPE_CHECKBOX,
+ PP_FLASH_MENUITEM_TYPE_SEPARATOR,
+ PP_FLASH_MENUITEM_TYPE_SUBMENU
+} PP_Flash_MenuItem_Type;
+
+struct PP_Flash_MenuItem {
+ PP_Flash_MenuItem_Type type;
+ char* name;
+ int32_t id;
+ PP_Bool enabled;
+ PP_Bool checked;
+ struct PP_Flash_Menu* submenu;
+};
+
+struct PP_Flash_Menu {
+ uint32_t count;
+ struct PP_Flash_MenuItem* items;
+};
+
+struct PPB_Flash_Menu {
+ PP_Resource (*Create)(PP_Instance instance_id,
+ const struct PP_Flash_Menu* menu_data);
+ PP_Bool (*IsFlashMenu)(PP_Resource resource_id);
+
+ // Display a context menu at the given location. If the user selects an item,
+ // |selected_id| will be set to its |id| and the callback called with |PP_OK|.
+ // If the user dismisses the menu without selecting an item,
+ // |PP_ERROR_USERCANCEL| will be indicated.
+ int32_t (*Show)(PP_Resource menu_id,
+ const struct PP_Point* location,
+ int32_t* selected_id,
+ PP_CompletionCallback callback);
+};
+
+#endif // PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_