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 // Full page plugin, so show page menu items. | 1175 (!embedder_web_contents_ || !embedder_web_contents_->IsSavable()))) { |
| 1176 // Both full page and embedded plugins are hosted as guest now, |
| 1177 // the difference is a full page plugin is not considered as savable. |
| 1178 // For full page plugin, we show page menu items. |
1176 if (params_.link_url.is_empty() && params_.selection_text.empty()) | 1179 if (params_.link_url.is_empty() && params_.selection_text.empty()) |
1177 AppendPageItems(); | 1180 AppendPageItems(); |
1178 } else { | 1181 } else { |
1179 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, | 1182 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, |
1180 IDS_CONTENT_CONTEXT_SAVEPAGEAS); | 1183 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
1181 // The "Print" menu item should always be included for plugins. If | 1184 // The "Print" menu item should always be included for plugins. If |
1182 // content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT) | 1185 // content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT) |
1183 // is true the item will be added inside AppendPrintItem(). Otherwise we | 1186 // is true the item will be added inside AppendPrintItem(). Otherwise we |
1184 // add "Print" here. | 1187 // add "Print" here. |
1185 if (!content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT)) | 1188 if (!content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT)) |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 void RenderViewContextMenu::PluginActionAt( | 2457 void RenderViewContextMenu::PluginActionAt( |
2455 const gfx::Point& location, | 2458 const gfx::Point& location, |
2456 const WebPluginAction& action) { | 2459 const WebPluginAction& action) { |
2457 source_web_contents_->GetRenderViewHost()-> | 2460 source_web_contents_->GetRenderViewHost()-> |
2458 ExecutePluginActionAtLocation(location, action); | 2461 ExecutePluginActionAtLocation(location, action); |
2459 } | 2462 } |
2460 | 2463 |
2461 Browser* RenderViewContextMenu::GetBrowser() const { | 2464 Browser* RenderViewContextMenu::GetBrowser() const { |
2462 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2465 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
2463 } | 2466 } |
OLD | NEW |