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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1164 | 1164 |
1165 void RenderViewContextMenu::AppendMediaItems() { | 1165 void RenderViewContextMenu::AppendMediaItems() { |
1166 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_LOOP, | 1166 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_LOOP, |
1167 IDS_CONTENT_CONTEXT_LOOP); | 1167 IDS_CONTENT_CONTEXT_LOOP); |
1168 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_CONTROLS, | 1168 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_CONTROLS, |
1169 IDS_CONTENT_CONTEXT_CONTROLS); | 1169 IDS_CONTENT_CONTEXT_CONTROLS); |
1170 } | 1170 } |
1171 | 1171 |
1172 void RenderViewContextMenu::AppendPluginItems() { | 1172 void RenderViewContextMenu::AppendPluginItems() { |
1173 if (params_.page_url == params_.src_url || | 1173 if (params_.page_url == params_.src_url || |
1174 guest_view::GuestViewBase::IsGuest(source_web_contents_)) { | 1174 (guest_view::GuestViewBase::IsGuest(source_web_contents_) && |
1175 !embedder_web_contents_->IsSavable())) { | |
lazyboy
2017/05/11 18:15:17
Can you add comments to explain this a bit? Someth
Wei Li
2017/05/17 05:37:09
Done.
| |
1175 // Full page plugin, so show page menu items. | 1176 // Full page plugin, so show page menu items. |
1176 if (params_.link_url.is_empty() && params_.selection_text.empty()) | 1177 if (params_.link_url.is_empty() && params_.selection_text.empty()) |
1177 AppendPageItems(); | 1178 AppendPageItems(); |
1178 } else { | 1179 } else { |
1179 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, | 1180 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, |
1180 IDS_CONTENT_CONTEXT_SAVEPAGEAS); | 1181 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
1181 // The "Print" menu item should always be included for plugins. If | 1182 // The "Print" menu item should always be included for plugins. If |
1182 // content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT) | 1183 // content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT) |
1183 // is true the item will be added inside AppendPrintItem(). Otherwise we | 1184 // is true the item will be added inside AppendPrintItem(). Otherwise we |
1184 // add "Print" here. | 1185 // add "Print" here. |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2454 void RenderViewContextMenu::PluginActionAt( | 2455 void RenderViewContextMenu::PluginActionAt( |
2455 const gfx::Point& location, | 2456 const gfx::Point& location, |
2456 const WebPluginAction& action) { | 2457 const WebPluginAction& action) { |
2457 source_web_contents_->GetRenderViewHost()-> | 2458 source_web_contents_->GetRenderViewHost()-> |
2458 ExecutePluginActionAtLocation(location, action); | 2459 ExecutePluginActionAtLocation(location, action); |
2459 } | 2460 } |
2460 | 2461 |
2461 Browser* RenderViewContextMenu::GetBrowser() const { | 2462 Browser* RenderViewContextMenu::GetBrowser() const { |
2462 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2463 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
2463 } | 2464 } |
OLD | NEW |