diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-26 22:09:46 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-26 22:09:46 +0000 |
commit | 6fd1a7a0bbac30baf3e8b3dae4b6ca147ae6b0d0 (patch) | |
tree | 29f4a818624baffec4b18f2c914018a3dfaa25f8 /chrome_frame/chrome_active_document.cc | |
parent | 44693a7a71fa420a541aaa8a9e79c2280fc61bc7 (diff) | |
download | chromium_src-6fd1a7a0bbac30baf3e8b3dae4b6ca147ae6b0d0.zip chromium_src-6fd1a7a0bbac30baf3e8b3dae4b6ca147ae6b0d0.tar.gz chromium_src-6fd1a7a0bbac30baf3e8b3dae4b6ca147ae6b0d0.tar.bz2 |
ChromeFrame host browser commands need to account for the command group guid and the command id in all cases. We were
detecting MSHTML command ids based on the command id only while ignoring the group which was wrong.
Part of the fix for http://code.google.com/p/chromium/issues/detail?id=24034
Bug=24034
Review URL: http://codereview.chromium.org/2873070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53699 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_active_document.cc')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index 79dc112..51a442a 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -104,13 +104,21 @@ HRESULT ChromeActiveDocument::FinalConstruct() { find_dialog_.Init(automation_client_.get()); - enabled_commands_map_[OLECMDID_PRINT] = true; - enabled_commands_map_[OLECMDID_FIND] = true; - enabled_commands_map_[OLECMDID_CUT] = true; - enabled_commands_map_[OLECMDID_COPY] = true; - enabled_commands_map_[OLECMDID_PASTE] = true; - enabled_commands_map_[OLECMDID_SELECTALL] = true; - enabled_commands_map_[OLECMDID_SAVEAS] = true; + OLECMDF flags = static_cast<OLECMDF>(OLECMDF_ENABLED | OLECMDF_SUPPORTED); + + null_group_commands_map_[OLECMDID_PRINT] = flags; + null_group_commands_map_[OLECMDID_FIND] = flags; + null_group_commands_map_[OLECMDID_CUT] = flags; + null_group_commands_map_[OLECMDID_COPY] = flags; + null_group_commands_map_[OLECMDID_PASTE] = flags; + null_group_commands_map_[OLECMDID_SELECTALL] = flags; + null_group_commands_map_[OLECMDID_SAVEAS] = flags; + + mshtml_group_commands_map_[IDM_BASELINEFONT1] = flags; + mshtml_group_commands_map_[IDM_BASELINEFONT2] = flags; + mshtml_group_commands_map_[IDM_BASELINEFONT3] = flags; + mshtml_group_commands_map_[IDM_BASELINEFONT4] = flags; + mshtml_group_commands_map_[IDM_BASELINEFONT5] = flags; HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); accelerator_table_ = @@ -314,17 +322,24 @@ STDMETHODIMP ChromeActiveDocument::QueryStatus(const GUID* cmd_group_guid, OLECMD commands[], OLECMDTEXT* command_text) { DLOG(INFO) << __FUNCTION__; - const GUID* supported_groups[] = { - &GUID_NULL, - &CGID_MSHTML, - &CGID_Explorer, - }; - bool supported = (cmd_group_guid == NULL); - for (int i = 0; !supported && i < arraysize(supported_groups); ++i) - supported = (IsEqualGUID(*cmd_group_guid, *supported_groups[i]) != FALSE); + CommandStatusMap* command_map = NULL; + + if (cmd_group_guid) { + if (IsEqualGUID(*cmd_group_guid, GUID_NULL)) { + command_map = &null_group_commands_map_; + } else if (IsEqualGUID(*cmd_group_guid, CGID_MSHTML)) { + command_map = &mshtml_group_commands_map_; + } else if (IsEqualGUID(*cmd_group_guid, CGID_Explorer)) { + command_map = &explorer_group_commands_map_; + } else if (IsEqualGUID(*cmd_group_guid, CGID_ShellDocView)) { + command_map = &shdoc_view_group_commands_map_; + } + } else { + command_map = &null_group_commands_map_; + } - if (!supported) { + if (!command_map) { DLOG(INFO) << "unsupported command group: " << GuidToString(*cmd_group_guid); return OLECMDERR_E_NOTSUPPORTED; @@ -333,9 +348,10 @@ STDMETHODIMP ChromeActiveDocument::QueryStatus(const GUID* cmd_group_guid, for (ULONG command_index = 0; command_index < number_of_commands; command_index++) { DLOG(INFO) << "Command id = " << commands[command_index].cmdID; - if (enabled_commands_map_.find(commands[command_index].cmdID) != - enabled_commands_map_.end()) - commands[command_index].cmdf = OLECMDF_ENABLED; + CommandStatusMap::iterator index = + command_map->find(commands[command_index].cmdID); + if (index != command_map->end()) + commands[command_index].cmdf = index->second; } return S_OK; } |