Chromium Code Reviews| 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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1363 case IDC_CONTENT_CONTEXT_REDO: | 1363 case IDC_CONTENT_CONTEXT_REDO: |
| 1364 return !!(params_.edit_flags & WebContextMenuData::CanRedo); | 1364 return !!(params_.edit_flags & WebContextMenuData::CanRedo); |
| 1365 | 1365 |
| 1366 case IDC_CONTENT_CONTEXT_CUT: | 1366 case IDC_CONTENT_CONTEXT_CUT: |
| 1367 return !!(params_.edit_flags & WebContextMenuData::CanCut); | 1367 return !!(params_.edit_flags & WebContextMenuData::CanCut); |
| 1368 | 1368 |
| 1369 case IDC_CONTENT_CONTEXT_COPY: | 1369 case IDC_CONTENT_CONTEXT_COPY: |
| 1370 return !!(params_.edit_flags & WebContextMenuData::CanCopy); | 1370 return !!(params_.edit_flags & WebContextMenuData::CanCopy); |
| 1371 | 1371 |
| 1372 case IDC_CONTENT_CONTEXT_PASTE: | 1372 case IDC_CONTENT_CONTEXT_PASTE: |
| 1373 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: | 1373 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: { |
| 1374 return !!(params_.edit_flags & WebContextMenuData::CanPaste); | 1374 std::vector<base::string16> types; |
| 1375 | 1375 bool ignore; |
| 1376 ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( | |
|
darin (slow to review)
2014/08/06 16:31:33
This is potentially an expensive call, right? Shou
| |
| 1377 ui::CLIPBOARD_TYPE_COPY_PASTE, &types, &ignore); | |
| 1378 return !types.empty(); | |
| 1379 } | |
| 1376 case IDC_CONTENT_CONTEXT_DELETE: | 1380 case IDC_CONTENT_CONTEXT_DELETE: |
| 1377 return !!(params_.edit_flags & WebContextMenuData::CanDelete); | 1381 return !!(params_.edit_flags & WebContextMenuData::CanDelete); |
| 1378 | 1382 |
| 1379 case IDC_CONTENT_CONTEXT_SELECTALL: | 1383 case IDC_CONTENT_CONTEXT_SELECTALL: |
| 1380 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); | 1384 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); |
| 1381 | 1385 |
| 1382 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: | 1386 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: |
| 1383 return !browser_context_->IsOffTheRecord() && | 1387 return !browser_context_->IsOffTheRecord() && |
| 1384 params_.link_url.is_valid() && | 1388 params_.link_url.is_valid() && |
| 1385 incognito_avail != IncognitoModePrefs::DISABLED; | 1389 incognito_avail != IncognitoModePrefs::DISABLED; |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2049 source_web_contents_->GetRenderViewHost()-> | 2053 source_web_contents_->GetRenderViewHost()-> |
| 2050 ExecuteMediaPlayerActionAtLocation(location, action); | 2054 ExecuteMediaPlayerActionAtLocation(location, action); |
| 2051 } | 2055 } |
| 2052 | 2056 |
| 2053 void RenderViewContextMenu::PluginActionAt( | 2057 void RenderViewContextMenu::PluginActionAt( |
| 2054 const gfx::Point& location, | 2058 const gfx::Point& location, |
| 2055 const WebPluginAction& action) { | 2059 const WebPluginAction& action) { |
| 2056 source_web_contents_->GetRenderViewHost()-> | 2060 source_web_contents_->GetRenderViewHost()-> |
| 2057 ExecutePluginActionAtLocation(location, action); | 2061 ExecutePluginActionAtLocation(location, action); |
| 2058 } | 2062 } |
| OLD | NEW |