Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1581)

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 410873005: Added code to disable 'paste' if nothing is present in clipboard to paste. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modified code as suggested Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_context_menu/render_view_context_menu.cc
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 8b1f54547a36a5301418e68b6e521c204cc1aece..77dea72d2e1d2677d383041438e8a3388967cdb5 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1364,9 +1364,14 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
return !!(params_.edit_flags & WebContextMenuData::CanCopy);
case IDC_CONTENT_CONTEXT_PASTE:
- case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE:
- return !!(params_.edit_flags & WebContextMenuData::CanPaste);
-
+ case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: {
+ // Disabled if clipboard has no data.
+ std::vector<base::string16> types;
+ bool ignore;
+ ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
+ ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore);
+ return types.size() > 0;
groby-ooo-7-16 2014/08/05 17:58:55 nit: !types.empty(), please
+ }
case IDC_CONTENT_CONTEXT_DELETE:
return !!(params_.edit_flags & WebContextMenuData::CanDelete);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698