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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1190 | 1190 |
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 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: { | |
1202 std::vector<base::string16> types; | 1201 std::vector<base::string16> types; |
1203 bool ignore; | 1202 bool ignore; |
1204 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( | 1203 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( |
1205 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore); | 1204 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore); |
1206 return !types.empty(); | 1205 return !types.empty(); |
1207 } | 1206 } |
1207 | |
1208 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: { | |
1209 base::string16 result; | |
1210 ui::Clipboard::GetForCurrentThread()->ReadText( | |
Avi (use Gerrit)
2014/12/02 15:10:31
Might you be able to use IsFormatAvailable?
Deepak
2014/12/03 04:18:21
Done.
| |
1211 ui::CLIPBOARD_TYPE_COPY_PASTE, &result); | |
1212 return !result.empty(); | |
1213 } | |
1214 | |
1208 case IDC_CONTENT_CONTEXT_DELETE: | 1215 case IDC_CONTENT_CONTEXT_DELETE: |
1209 return !!(params_.edit_flags & WebContextMenuData::CanDelete); | 1216 return !!(params_.edit_flags & WebContextMenuData::CanDelete); |
1210 | 1217 |
1211 case IDC_CONTENT_CONTEXT_SELECTALL: | 1218 case IDC_CONTENT_CONTEXT_SELECTALL: |
1212 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); | 1219 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); |
1213 | 1220 |
1214 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: | 1221 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: |
1215 return !browser_context_->IsOffTheRecord() && | 1222 return !browser_context_->IsOffTheRecord() && |
1216 params_.link_url.is_valid() && | 1223 params_.link_url.is_valid() && |
1217 incognito_avail != IncognitoModePrefs::DISABLED; | 1224 incognito_avail != IncognitoModePrefs::DISABLED; |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1770 source_web_contents_->GetRenderViewHost()-> | 1777 source_web_contents_->GetRenderViewHost()-> |
1771 ExecuteMediaPlayerActionAtLocation(location, action); | 1778 ExecuteMediaPlayerActionAtLocation(location, action); |
1772 } | 1779 } |
1773 | 1780 |
1774 void RenderViewContextMenu::PluginActionAt( | 1781 void RenderViewContextMenu::PluginActionAt( |
1775 const gfx::Point& location, | 1782 const gfx::Point& location, |
1776 const WebPluginAction& action) { | 1783 const WebPluginAction& action) { |
1777 source_web_contents_->GetRenderViewHost()-> | 1784 source_web_contents_->GetRenderViewHost()-> |
1778 ExecutePluginActionAtLocation(location, action); | 1785 ExecutePluginActionAtLocation(location, action); |
1779 } | 1786 } |
OLD | NEW |