Added code to disable 'paste' if nothing is present in clipboard to paste.

On right click in editable node context menu was always having 'paste'
option as enabled. Added check that if clipboard is not empty
then only show 'paste' option.

BUG=396616

Review URL: https://codereview.chromium.org/443073002

Cr-Commit-Position: refs/heads/master@{#288461}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288461 0039d316-1c4b-4281-b951-d872f2087c98
parent 3ec9a55a
...@@ -1181,9 +1181,13 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { ...@@ -1181,9 +1181,13 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
return !!(params_.edit_flags & WebContextMenuData::CanCopy); return !!(params_.edit_flags & WebContextMenuData::CanCopy);
case IDC_CONTENT_CONTEXT_PASTE: case IDC_CONTENT_CONTEXT_PASTE:
case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: {
return !!(params_.edit_flags & WebContextMenuData::CanPaste); std::vector<base::string16> types;
bool ignore;
ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore);
return !types.empty();
}
case IDC_CONTENT_CONTEXT_DELETE: case IDC_CONTENT_CONTEXT_DELETE:
return !!(params_.edit_flags & WebContextMenuData::CanDelete); return !!(params_.edit_flags & WebContextMenuData::CanDelete);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment