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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 | 946 |
947 menu_model_.AddSubMenu( | 947 menu_model_.AddSubMenu( |
948 IDC_CONTENT_CONTEXT_OPENLINKWITH, | 948 IDC_CONTENT_CONTEXT_OPENLINKWITH, |
949 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_OPENLINKWITH), | 949 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_OPENLINKWITH), |
950 &protocol_handler_submenu_model_); | 950 &protocol_handler_submenu_model_); |
951 } | 951 } |
952 | 952 |
953 // Menu delegate functions ----------------------------------------------------- | 953 // Menu delegate functions ----------------------------------------------------- |
954 | 954 |
955 bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { | 955 bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { |
956 if (RenderViewContextMenuBase::IsCommandIdEnabled(id)) | 956 { |
957 return true; | 957 bool enabled = false; |
| 958 if (RenderViewContextMenuBase::IsCommandIdKnown(id, &enabled)) |
| 959 return enabled; |
| 960 } |
958 | 961 |
959 CoreTabHelper* core_tab_helper = | 962 CoreTabHelper* core_tab_helper = |
960 CoreTabHelper::FromWebContents(source_web_contents_); | 963 CoreTabHelper::FromWebContents(source_web_contents_); |
961 int content_restrictions = 0; | 964 int content_restrictions = 0; |
962 if (core_tab_helper) | 965 if (core_tab_helper) |
963 content_restrictions = core_tab_helper->content_restrictions(); | 966 content_restrictions = core_tab_helper->content_restrictions(); |
964 if (id == IDC_PRINT && (content_restrictions & CONTENT_RESTRICTION_PRINT)) | 967 if (id == IDC_PRINT && (content_restrictions & CONTENT_RESTRICTION_PRINT)) |
965 return false; | 968 return false; |
966 | 969 |
967 if (id == IDC_SAVE_PAGE && | 970 if (id == IDC_SAVE_PAGE && |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 source_web_contents_->GetRenderViewHost()-> | 1787 source_web_contents_->GetRenderViewHost()-> |
1785 ExecuteMediaPlayerActionAtLocation(location, action); | 1788 ExecuteMediaPlayerActionAtLocation(location, action); |
1786 } | 1789 } |
1787 | 1790 |
1788 void RenderViewContextMenu::PluginActionAt( | 1791 void RenderViewContextMenu::PluginActionAt( |
1789 const gfx::Point& location, | 1792 const gfx::Point& location, |
1790 const WebPluginAction& action) { | 1793 const WebPluginAction& action) { |
1791 source_web_contents_->GetRenderViewHost()-> | 1794 source_web_contents_->GetRenderViewHost()-> |
1792 ExecutePluginActionAtLocation(location, action); | 1795 ExecutePluginActionAtLocation(location, action); |
1793 } | 1796 } |
OLD | NEW |