OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // toggling is ignored in that case. | 247 // toggling is ignored in that case. |
248 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && | 248 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && |
249 !mediaElement->isFullscreen()) | 249 !mediaElement->isFullscreen()) |
250 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; | 250 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; |
251 if (mediaElement->shouldShowControls()) | 251 if (mediaElement->shouldShowControls()) |
252 data.mediaFlags |= WebContextMenuData::MediaControls; | 252 data.mediaFlags |= WebContextMenuData::MediaControls; |
253 } else if (isHTMLObjectElement(*r.innerNode()) || | 253 } else if (isHTMLObjectElement(*r.innerNode()) || |
254 isHTMLEmbedElement(*r.innerNode())) { | 254 isHTMLEmbedElement(*r.innerNode())) { |
255 LayoutObject* object = r.innerNode()->layoutObject(); | 255 LayoutObject* object = r.innerNode()->layoutObject(); |
256 if (object && object->isLayoutPart()) { | 256 if (object && object->isLayoutPart()) { |
257 FrameViewBase* frameViewBase = toLayoutPart(object)->frameViewBase(); | 257 PluginView* pluginView = toLayoutPart(object)->plugin(); |
258 if (frameViewBase && frameViewBase->isPluginContainer()) { | 258 if (pluginView && pluginView->isPluginContainer()) { |
259 data.mediaType = WebContextMenuData::MediaTypePlugin; | 259 data.mediaType = WebContextMenuData::MediaTypePlugin; |
260 WebPluginContainerImpl* plugin = | 260 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(pluginView); |
261 toWebPluginContainerImpl(toPluginView(frameViewBase)); | |
262 WebString text = plugin->plugin()->selectionAsText(); | 261 WebString text = plugin->plugin()->selectionAsText(); |
263 if (!text.isEmpty()) { | 262 if (!text.isEmpty()) { |
264 data.selectedText = text; | 263 data.selectedText = text; |
265 data.editFlags |= WebContextMenuData::CanCopy; | 264 data.editFlags |= WebContextMenuData::CanCopy; |
266 } | 265 } |
267 data.editFlags &= ~WebContextMenuData::CanTranslate; | 266 data.editFlags &= ~WebContextMenuData::CanTranslate; |
268 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); | 267 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); |
269 if (plugin->plugin()->supportsPaginatedPrint()) | 268 if (plugin->plugin()->supportsPaginatedPrint()) |
270 data.mediaFlags |= WebContextMenuData::MediaCanPrint; | 269 data.mediaFlags |= WebContextMenuData::MediaCanPrint; |
271 | 270 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 subMenuItems.swap(outputItems); | 451 subMenuItems.swap(outputItems); |
453 } | 452 } |
454 | 453 |
455 void ContextMenuClientImpl::populateCustomMenuItems( | 454 void ContextMenuClientImpl::populateCustomMenuItems( |
456 const ContextMenu* defaultMenu, | 455 const ContextMenu* defaultMenu, |
457 WebContextMenuData* data) { | 456 WebContextMenuData* data) { |
458 populateSubMenuItems(defaultMenu->items(), data->customItems); | 457 populateSubMenuItems(defaultMenu->items(), data->customItems); |
459 } | 458 } |
460 | 459 |
461 } // namespace blink | 460 } // namespace blink |
OLD | NEW |