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

Side by Side 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, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 case IDC_CONTENT_CONTEXT_REDO: 1357 case IDC_CONTENT_CONTEXT_REDO:
1358 return !!(params_.edit_flags & WebContextMenuData::CanRedo); 1358 return !!(params_.edit_flags & WebContextMenuData::CanRedo);
1359 1359
1360 case IDC_CONTENT_CONTEXT_CUT: 1360 case IDC_CONTENT_CONTEXT_CUT:
1361 return !!(params_.edit_flags & WebContextMenuData::CanCut); 1361 return !!(params_.edit_flags & WebContextMenuData::CanCut);
1362 1362
1363 case IDC_CONTENT_CONTEXT_COPY: 1363 case IDC_CONTENT_CONTEXT_COPY:
1364 return !!(params_.edit_flags & WebContextMenuData::CanCopy); 1364 return !!(params_.edit_flags & WebContextMenuData::CanCopy);
1365 1365
1366 case IDC_CONTENT_CONTEXT_PASTE: 1366 case IDC_CONTENT_CONTEXT_PASTE:
1367 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: 1367 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: {
1368 return !!(params_.edit_flags & WebContextMenuData::CanPaste); 1368 // Disabled if clipboard has no data.
1369 1369 std::vector<base::string16> types;
1370 bool ignore;
1371 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
1372 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore);
1373 return types.size() > 0;
groby-ooo-7-16 2014/08/05 17:58:55 nit: !types.empty(), please
1374 }
1370 case IDC_CONTENT_CONTEXT_DELETE: 1375 case IDC_CONTENT_CONTEXT_DELETE:
1371 return !!(params_.edit_flags & WebContextMenuData::CanDelete); 1376 return !!(params_.edit_flags & WebContextMenuData::CanDelete);
1372 1377
1373 case IDC_CONTENT_CONTEXT_SELECTALL: 1378 case IDC_CONTENT_CONTEXT_SELECTALL:
1374 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); 1379 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll);
1375 1380
1376 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: 1381 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD:
1377 return !browser_context_->IsOffTheRecord() && 1382 return !browser_context_->IsOffTheRecord() &&
1378 params_.link_url.is_valid() && 1383 params_.link_url.is_valid() &&
1379 incognito_avail != IncognitoModePrefs::DISABLED; 1384 incognito_avail != IncognitoModePrefs::DISABLED;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 source_web_contents_->GetRenderViewHost()-> 2040 source_web_contents_->GetRenderViewHost()->
2036 ExecuteMediaPlayerActionAtLocation(location, action); 2041 ExecuteMediaPlayerActionAtLocation(location, action);
2037 } 2042 }
2038 2043
2039 void RenderViewContextMenu::PluginActionAt( 2044 void RenderViewContextMenu::PluginActionAt(
2040 const gfx::Point& location, 2045 const gfx::Point& location,
2041 const WebPluginAction& action) { 2046 const WebPluginAction& action) {
2042 source_web_contents_->GetRenderViewHost()-> 2047 source_web_contents_->GetRenderViewHost()->
2043 ExecutePluginActionAtLocation(location, action); 2048 ExecutePluginActionAtLocation(location, action);
2044 } 2049 }
OLDNEW
« 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