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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 751823004: 'Paste' & 'Paste as plain text' should check edit_flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nit. Created 6 years 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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 case IDC_CONTENT_CONTEXT_REDO: 1191 case IDC_CONTENT_CONTEXT_REDO:
1192 return !!(params_.edit_flags & WebContextMenuData::CanRedo); 1192 return !!(params_.edit_flags & WebContextMenuData::CanRedo);
1193 1193
1194 case IDC_CONTENT_CONTEXT_CUT: 1194 case IDC_CONTENT_CONTEXT_CUT:
1195 return !!(params_.edit_flags & WebContextMenuData::CanCut); 1195 return !!(params_.edit_flags & WebContextMenuData::CanCut);
1196 1196
1197 case IDC_CONTENT_CONTEXT_COPY: 1197 case IDC_CONTENT_CONTEXT_COPY:
1198 return !!(params_.edit_flags & WebContextMenuData::CanCopy); 1198 return !!(params_.edit_flags & WebContextMenuData::CanCopy);
1199 1199
1200 case IDC_CONTENT_CONTEXT_PASTE: { 1200 case IDC_CONTENT_CONTEXT_PASTE: {
1201 if (!(params_.edit_flags & WebContextMenuData::CanPaste))
1202 return false;
1203
1201 std::vector<base::string16> types; 1204 std::vector<base::string16> types;
1202 bool ignore; 1205 bool ignore;
1203 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( 1206 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
1204 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore); 1207 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore);
1205 return !types.empty(); 1208 return !types.empty();
1206 } 1209 }
1207 1210
1208 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: { 1211 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: {
1212 if (!(params_.edit_flags & WebContextMenuData::CanPaste))
1213 return false;
1214
1209 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( 1215 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable(
1210 ui::Clipboard::GetPlainTextFormatType(), 1216 ui::Clipboard::GetPlainTextFormatType(),
1211 ui::CLIPBOARD_TYPE_COPY_PASTE); 1217 ui::CLIPBOARD_TYPE_COPY_PASTE);
1212 } 1218 }
1213 1219
1214 case IDC_CONTENT_CONTEXT_DELETE: 1220 case IDC_CONTENT_CONTEXT_DELETE:
1215 return !!(params_.edit_flags & WebContextMenuData::CanDelete); 1221 return !!(params_.edit_flags & WebContextMenuData::CanDelete);
1216 1222
1217 case IDC_CONTENT_CONTEXT_SELECTALL: 1223 case IDC_CONTENT_CONTEXT_SELECTALL:
1218 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); 1224 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll);
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 source_web_contents_->GetRenderViewHost()-> 1782 source_web_contents_->GetRenderViewHost()->
1777 ExecuteMediaPlayerActionAtLocation(location, action); 1783 ExecuteMediaPlayerActionAtLocation(location, action);
1778 } 1784 }
1779 1785
1780 void RenderViewContextMenu::PluginActionAt( 1786 void RenderViewContextMenu::PluginActionAt(
1781 const gfx::Point& location, 1787 const gfx::Point& location,
1782 const WebPluginAction& action) { 1788 const WebPluginAction& action) {
1783 source_web_contents_->GetRenderViewHost()-> 1789 source_web_contents_->GetRenderViewHost()->
1784 ExecutePluginActionAtLocation(location, action); 1790 ExecutePluginActionAtLocation(location, action);
1785 } 1791 }
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