diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-12 03:50:39 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-12 03:50:39 +0000 |
commit | e943d666020b7275d7fb70db625b47f69712d3b3 (patch) | |
tree | d56f0d56bb766103e8c51566f46197966a689cb1 /chrome/test | |
parent | d66688b2a167882dad56fcb6d963d918ed413052 (diff) | |
download | chromium_src-e943d666020b7275d7fb70db625b47f69712d3b3.zip chromium_src-e943d666020b7275d7fb70db625b47f69712d3b3.tar.gz chromium_src-e943d666020b7275d7fb70db625b47f69712d3b3.tar.bz2 |
Allow external hosts to handle the context menu and thus be able to customize it.
Changes include
1. A HandleContextMenu function which can be implemented by a TabContentsDelegate. Currently only ExternalTabContainer implements this.
2. Removed InitMenu calls from the RenderViewContextMenu subclass constructors, We need the subclasses to be able to override individual AddMenuItem calls. The newly added RenderViewContextMenuExternalWin class derives from RenderViewContextMenuWin whose constructor calls InitMenu. This happens at a time when the vtable is not yet setup. To fix this we added an Init function to the RenderViewContextMenu base class which then calls a virtual function DoInit, which derived classes can override to perform specific initializations.
3. Added automation messages to send over context menu events to external hosts and back
amit, please review everything. estade please review changes to tab_contents_view_gtk.cc and
render_view_context_menu_gtk.cc. pinkerton please review changes to tab_contents_view_mac.mm and
render_view_context_menu_mac.mm
Review URL: http://codereview.chromium.org/119429
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rwxr-xr-x | chrome/test/automation/automation_messages_internal.h | 12 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 5 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 4 |
3 files changed, 21 insertions, 0 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index d746202..7e20454 100755 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -939,5 +939,17 @@ IPC_BEGIN_MESSAGES(Automation) IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BlockedPopupCount, int /* tab_handle */, int /* blocked_popup_count */) +#if defined(OS_WIN) + IPC_MESSAGE_ROUTED5(AutomationMsg_ForwardContextMenuToExternalHost, + int /* tab_handle */, + HANDLE /* source menu handle */, + int /* the x coordinate for displaying the menu */, + int /* the y coordinate for displaying the menu */, + int /* align flags */) + + IPC_MESSAGE_ROUTED2(AutomationMsg_ForwardContextMenuCommandToChrome, + int /* tab_handle */, + int /* selected_command */) +#endif // OS_WIN IPC_END_MESSAGES(Automation) diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index 1a2d1144..f81e23b 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -662,6 +662,11 @@ void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, sender_->Send(new AutomationMsg_TabReposition(0, handle_, params)); } +void TabProxy::SendContextMenuCommand(int selected_command) { + sender_->Send(new AutomationMsg_ForwardContextMenuCommandToChrome( + 0, handle_, selected_command)); +} + #endif // defined(OS_WIN) void TabProxy::AddObserver(TabProxyDelegate* observer) { diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 2b142b1..5366119 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -303,6 +303,10 @@ class TabProxy : public AutomationResourceProxy { // passed in. void Reposition(HWND window, HWND window_insert_after, int left, int top, int width, int height, int flags, HWND parent_window); + + // Sends the selected context menu command to the chrome instance + void SendContextMenuCommand(int selected_command); + #endif // defined(OS_WIN) // Calls delegates |