diff options
author | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 00:07:34 +0000 |
---|---|---|
committer | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 00:07:34 +0000 |
commit | b45b76e2e22e913450e79a0df076728726a6fc2e (patch) | |
tree | 8ba8541d7635b6c05a88dd66ef1dc6f9702a9bd1 /chrome_frame/chrome_active_document.h | |
parent | 900fbb8ca64704302e6714f730b60aad336d231b (diff) | |
download | chromium_src-b45b76e2e22e913450e79a0df076728726a6fc2e.zip chromium_src-b45b76e2e22e913450e79a0df076728726a6fc2e.tar.gz chromium_src-b45b76e2e22e913450e79a0df076728726a6fc2e.tar.bz2 |
Fix IOleCommandTarget::Exec handling taking into account command group id.
BUG=none
TEST=chrome_frame_tests
Review URL: http://codereview.chromium.org/594034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_active_document.h')
-rw-r--r-- | chrome_frame/chrome_active_document.h | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h index f2b26d6..aeec2d82 100644 --- a/chrome_frame/chrome_active_document.h +++ b/chrome_frame/chrome_active_document.h @@ -73,34 +73,37 @@ class ChromeActiveDocument; DWORD cmd_exec_opt, VARIANT* in_args, \ VARIANT* out_args) { \ HRESULT hr = OLECMDERR_E_NOTSUPPORTED; \ - switch (command_id) { + do { - -#define EXEC_COMMAND_HANDLER(id, handler) \ - case id: { \ +#define EXEC_COMMAND_HANDLER(group, id, handler) \ + if ((id == command_id) && ((group != NULL && cmd_group_guid != NULL && \ + IsEqualGUID(*(GUID*)group,*cmd_group_guid)) || \ + (group == NULL && cmd_group_guid == NULL))) { \ hr = S_OK; \ handler(cmd_group_guid, command_id, cmd_exec_opt, in_args, out_args); \ break; \ } -#define EXEC_COMMAND_HANDLER_NO_ARGS(id, handler) \ - case id: { \ +#define EXEC_COMMAND_HANDLER_NO_ARGS(group, id, handler) \ + if ((id == command_id) && ((group != NULL && cmd_group_guid != NULL && \ + IsEqualGUID(*(GUID*)group,*cmd_group_guid)) || \ + (group == NULL && cmd_group_guid == NULL))) { \ hr = S_OK; \ handler(); \ break; \ } -#define EXEC_COMMAND_HANDLER_GENERIC(id, code) \ - case id: { \ +#define EXEC_COMMAND_HANDLER_GENERIC(group, id, code) \ + if ((id == command_id) && ((group != NULL && cmd_group_guid != NULL && \ + IsEqualGUID(*(GUID*)group,*cmd_group_guid)) || \ + (group == NULL && cmd_group_guid == NULL))) { \ hr = S_OK; \ code; \ break; \ } #define END_EXEC_COMMAND_MAP() \ - default: \ - break; \ - } \ + } while(0); \ return hr; \ } @@ -148,27 +151,30 @@ END_MSG_MAP() HRESULT FinalConstruct(); -#define FORWARD_TAB_COMMAND(id, command) \ - EXEC_COMMAND_HANDLER_GENERIC(id, GetTabProxy() ? GetTabProxy()->command() : 1) +#define FORWARD_TAB_COMMAND(group, id, command) \ + EXEC_COMMAND_HANDLER_GENERIC(group, id, GetTabProxy() ? \ + GetTabProxy()->command() : 1) BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument) - EXEC_COMMAND_HANDLER_GENERIC(OLECMDID_PRINT, automation_client_->PrintTab()) - EXEC_COMMAND_HANDLER_NO_ARGS(OLECMDID_FIND, OnFindInPage) - EXEC_COMMAND_HANDLER_NO_ARGS(IDM_FIND, OnFindInPage) - EXEC_COMMAND_HANDLER_NO_ARGS(IDM_VIEWSOURCE, OnViewSource) - FORWARD_TAB_COMMAND(OLECMDID_SELECTALL, SelectAll) - FORWARD_TAB_COMMAND(OLECMDID_CUT, Cut) - FORWARD_TAB_COMMAND(OLECMDID_COPY, Copy) - FORWARD_TAB_COMMAND(OLECMDID_PASTE, Paste) - FORWARD_TAB_COMMAND(OLECMDID_REFRESH, ReloadAsync) - FORWARD_TAB_COMMAND(OLECMDID_STOP, StopAsync) - FORWARD_TAB_COMMAND(OLECMDID_SAVEAS, SaveAsAsync) - EXEC_COMMAND_HANDLER(SBCMDID_MIXEDZONE, OnDetermineSecurityZone) - EXEC_COMMAND_HANDLER(IDM_BASELINEFONT1, SetPageFontSize) - EXEC_COMMAND_HANDLER(IDM_BASELINEFONT2, SetPageFontSize) - EXEC_COMMAND_HANDLER(IDM_BASELINEFONT3, SetPageFontSize) - EXEC_COMMAND_HANDLER(IDM_BASELINEFONT4, SetPageFontSize) - EXEC_COMMAND_HANDLER(IDM_BASELINEFONT5, SetPageFontSize) + EXEC_COMMAND_HANDLER_GENERIC(NULL, OLECMDID_PRINT, + automation_client_->PrintTab()) + EXEC_COMMAND_HANDLER_NO_ARGS(NULL, OLECMDID_FIND, OnFindInPage) + EXEC_COMMAND_HANDLER_NO_ARGS(&CGID_MSHTML, IDM_FIND, OnFindInPage) + EXEC_COMMAND_HANDLER_NO_ARGS(&CGID_MSHTML, IDM_VIEWSOURCE, OnViewSource) + FORWARD_TAB_COMMAND(NULL, OLECMDID_SELECTALL, SelectAll) + FORWARD_TAB_COMMAND(NULL, OLECMDID_CUT, Cut) + FORWARD_TAB_COMMAND(NULL, OLECMDID_COPY, Copy) + FORWARD_TAB_COMMAND(NULL, OLECMDID_PASTE, Paste) + FORWARD_TAB_COMMAND(NULL, OLECMDID_REFRESH, ReloadAsync) + FORWARD_TAB_COMMAND(NULL, OLECMDID_STOP, StopAsync) + FORWARD_TAB_COMMAND(NULL, OLECMDID_SAVEAS, SaveAsAsync) + EXEC_COMMAND_HANDLER(&CGID_Explorer, SBCMDID_MIXEDZONE, + OnDetermineSecurityZone) + EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT1, SetPageFontSize) + EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT2, SetPageFontSize) + EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT3, SetPageFontSize) + EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT4, SetPageFontSize) + EXEC_COMMAND_HANDLER(&CGID_MSHTML, IDM_BASELINEFONT5, SetPageFontSize) END_EXEC_COMMAND_MAP() // IPCs from automation server. |