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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // toggling is ignored in that case. | 246 // toggling is ignored in that case. |
247 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && | 247 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && |
248 !mediaElement->isFullscreen()) | 248 !mediaElement->isFullscreen()) |
249 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; | 249 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; |
250 if (mediaElement->shouldShowControls()) | 250 if (mediaElement->shouldShowControls()) |
251 data.mediaFlags |= WebContextMenuData::MediaControls; | 251 data.mediaFlags |= WebContextMenuData::MediaControls; |
252 } else if (isHTMLObjectElement(*r.innerNode()) || | 252 } else if (isHTMLObjectElement(*r.innerNode()) || |
253 isHTMLEmbedElement(*r.innerNode())) { | 253 isHTMLEmbedElement(*r.innerNode())) { |
254 LayoutObject* object = r.innerNode()->layoutObject(); | 254 LayoutObject* object = r.innerNode()->layoutObject(); |
255 if (object && object->isLayoutPart()) { | 255 if (object && object->isLayoutPart()) { |
256 FrameViewBase* frameViewBase = toLayoutPart(object)->frameViewBase(); | 256 PluginView* pluginView = toLayoutPart(object)->plugin(); |
257 if (frameViewBase && frameViewBase->isPluginContainer()) { | 257 if (pluginView && pluginView->isPluginContainer()) { |
258 data.mediaType = WebContextMenuData::MediaTypePlugin; | 258 data.mediaType = WebContextMenuData::MediaTypePlugin; |
259 WebPluginContainerImpl* plugin = | 259 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(pluginView); |
260 toWebPluginContainerImpl(toPluginView(frameViewBase)); | |
261 WebString text = plugin->plugin()->selectionAsText(); | 260 WebString text = plugin->plugin()->selectionAsText(); |
262 if (!text.isEmpty()) { | 261 if (!text.isEmpty()) { |
263 data.selectedText = text; | 262 data.selectedText = text; |
264 data.editFlags |= WebContextMenuData::CanCopy; | 263 data.editFlags |= WebContextMenuData::CanCopy; |
265 } | 264 } |
266 data.editFlags &= ~WebContextMenuData::CanTranslate; | 265 data.editFlags &= ~WebContextMenuData::CanTranslate; |
267 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); | 266 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); |
268 if (plugin->plugin()->supportsPaginatedPrint()) | 267 if (plugin->plugin()->supportsPaginatedPrint()) |
269 data.mediaFlags |= WebContextMenuData::MediaCanPrint; | 268 data.mediaFlags |= WebContextMenuData::MediaCanPrint; |
270 | 269 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 subMenuItems.swap(outputItems); | 450 subMenuItems.swap(outputItems); |
452 } | 451 } |
453 | 452 |
454 void ContextMenuClientImpl::populateCustomMenuItems( | 453 void ContextMenuClientImpl::populateCustomMenuItems( |
455 const ContextMenu* defaultMenu, | 454 const ContextMenu* defaultMenu, |
456 WebContextMenuData* data) { | 455 WebContextMenuData* data) { |
457 populateSubMenuItems(defaultMenu->items(), data->customItems); | 456 populateSubMenuItems(defaultMenu->items(), data->customItems); |
458 } | 457 } |
459 | 458 |
460 } // namespace blink | 459 } // namespace blink |
OLD | NEW |