diff options
author | rhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 16:54:12 +0000 |
---|---|---|
committer | rhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 16:54:12 +0000 |
commit | b516e2d2ff5ad3d2a7c754b081566137fd7ed089 (patch) | |
tree | 75d5a32b65ce6b417eba6ff42fe0dbe3d1d8c5b1 /chrome/common/automation_messages.h | |
parent | 471072f9fd132a46b24ddd159922f6a4d099707d (diff) | |
download | chromium_src-b516e2d2ff5ad3d2a7c754b081566137fd7ed089.zip chromium_src-b516e2d2ff5ad3d2a7c754b081566137fd7ed089.tar.gz chromium_src-b516e2d2ff5ad3d2a7c754b081566137fd7ed089.tar.bz2 |
Convert RenderViewContextMenu to MenuItemView.
This CL is part of general GTK removal for ChromiumOS. Menu2 uses GTK on linux so we are replacing it with MenuItemView. Chrome Frame currently passes the context menu between processes by using the HMENU. Because MenuItemView does not use HMENU, we need to use another mechanism.
This CL creates a ContextMenuModel struct that is serialized into an automation message for Chrome Frame. ContextMenuModel contains the context menu definition in-band replacing the out-of-band HMENU.
BUG=chromium-os:13887
TEST=none
Review URL: http://codereview.chromium.org/7167002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92182 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/automation_messages.h')
-rw-r--r-- | chrome/common/automation_messages.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h index e714c45..91ec439 100644 --- a/chrome/common/automation_messages.h +++ b/chrome/common/automation_messages.h @@ -4,8 +4,10 @@ // Multiply-included message file, no traditional include guard. #include <string> +#include <vector> #include "base/basictypes.h" +#include "base/memory/ref_counted.h" #include "chrome/common/automation_constants.h" #include "chrome/common/content_settings.h" #include "content/common/common_param_traits.h" @@ -153,6 +155,42 @@ struct MiniContextMenuParams { GURL frame_url; }; +// This struct passes information about the context menu in Chrome stored +// as a ui::MenuModel to Chrome Frame. It is basically a container of +// items that go in the menu. An item may be a submenu, so the data +// structure may be a tree. +struct ContextMenuModel { + ContextMenuModel(); + ~ContextMenuModel(); + + // This struct describes one item in the menu. + struct Item { + Item(); + + // This is the type of the menu item, using values from the enum + // ui::MenuModel::ItemType (serialized as an int). + int type; + + // This is the command id of the menu item, which will be passed by + // Chrome Frame to Chrome if the item is selected. + int item_id; + + // This the the menu label, if needed. + std::wstring label; + + // These are states of the menu item. + bool checked; + bool enabled; + + // This recursively describes the submenu if type is + // ui::MenuModel::TYPE_SUBMENU. + ContextMenuModel* submenu; + }; + + // This is the list of menu items. + std::vector<Item> items; +}; + struct AttachExternalTabParams { AttachExternalTabParams(); AttachExternalTabParams(uint64 cookie, @@ -354,6 +392,15 @@ struct ParamTraits<MiniContextMenuParams> { static void Log(const param_type& p, std::string* l); }; +// Traits for ContextMenuModel structure to pack/unpack. +template <> +struct ParamTraits<ContextMenuModel> { + typedef ContextMenuModel param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + template <> struct ParamTraits<AttachExternalTabParams> { typedef AttachExternalTabParams param_type; |