OLD | NEW |
---|---|
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 Loading... | |
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 bool paste_enabled = | |
1202 ((params_.edit_flags & WebContextMenuData::CanPaste) != 0); | |
1203 if (!paste_enabled) | |
1204 return paste_enabled; | |
lazyboy
2014/12/09 03:57:58
nit: This seems a bit verbose, isn't sth like:
if
Deepak
2014/12/09 04:48:06
Done.
| |
1205 | |
1201 std::vector<base::string16> types; | 1206 std::vector<base::string16> types; |
1202 bool ignore; | 1207 bool ignore; |
1203 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( | 1208 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( |
1204 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore); | 1209 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore); |
1205 return !types.empty(); | 1210 return !types.empty(); |
1206 } | 1211 } |
1207 | 1212 |
1208 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: { | 1213 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: { |
1214 bool paste_enabled = | |
1215 ((params_.edit_flags & WebContextMenuData::CanPaste) != 0); | |
1216 if (!paste_enabled) | |
1217 return paste_enabled; | |
1218 | |
1209 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( | 1219 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( |
1210 ui::Clipboard::GetPlainTextFormatType(), | 1220 ui::Clipboard::GetPlainTextFormatType(), |
1211 ui::CLIPBOARD_TYPE_COPY_PASTE); | 1221 ui::CLIPBOARD_TYPE_COPY_PASTE); |
1212 } | 1222 } |
1213 | 1223 |
1214 case IDC_CONTENT_CONTEXT_DELETE: | 1224 case IDC_CONTENT_CONTEXT_DELETE: |
1215 return !!(params_.edit_flags & WebContextMenuData::CanDelete); | 1225 return !!(params_.edit_flags & WebContextMenuData::CanDelete); |
1216 | 1226 |
1217 case IDC_CONTENT_CONTEXT_SELECTALL: | 1227 case IDC_CONTENT_CONTEXT_SELECTALL: |
1218 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); | 1228 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1776 source_web_contents_->GetRenderViewHost()-> | 1786 source_web_contents_->GetRenderViewHost()-> |
1777 ExecuteMediaPlayerActionAtLocation(location, action); | 1787 ExecuteMediaPlayerActionAtLocation(location, action); |
1778 } | 1788 } |
1779 | 1789 |
1780 void RenderViewContextMenu::PluginActionAt( | 1790 void RenderViewContextMenu::PluginActionAt( |
1781 const gfx::Point& location, | 1791 const gfx::Point& location, |
1782 const WebPluginAction& action) { | 1792 const WebPluginAction& action) { |
1783 source_web_contents_->GetRenderViewHost()-> | 1793 source_web_contents_->GetRenderViewHost()-> |
1784 ExecutePluginActionAtLocation(location, action); | 1794 ExecutePluginActionAtLocation(location, action); |
1785 } | 1795 } |
OLD | NEW |