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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // toggling is ignored in that case. | 245 // toggling is ignored in that case. |
246 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && | 246 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && |
247 !mediaElement->isFullscreen()) | 247 !mediaElement->isFullscreen()) |
248 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; | 248 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; |
249 if (mediaElement->shouldShowControls()) | 249 if (mediaElement->shouldShowControls()) |
250 data.mediaFlags |= WebContextMenuData::MediaControls; | 250 data.mediaFlags |= WebContextMenuData::MediaControls; |
251 } else if (isHTMLObjectElement(*r.innerNode()) || | 251 } else if (isHTMLObjectElement(*r.innerNode()) || |
252 isHTMLEmbedElement(*r.innerNode())) { | 252 isHTMLEmbedElement(*r.innerNode())) { |
253 LayoutObject* object = r.innerNode()->layoutObject(); | 253 LayoutObject* object = r.innerNode()->layoutObject(); |
254 if (object && object->isLayoutPart()) { | 254 if (object && object->isLayoutPart()) { |
255 FrameViewBase* frameViewBase = toLayoutPart(object)->frameViewBase(); | 255 PluginView* pluginView = toLayoutPart(object)->plugin(); |
256 if (frameViewBase && frameViewBase->isPluginContainer()) { | 256 if (pluginView && pluginView->isPluginContainer()) { |
257 data.mediaType = WebContextMenuData::MediaTypePlugin; | 257 data.mediaType = WebContextMenuData::MediaTypePlugin; |
258 WebPluginContainerImpl* plugin = | 258 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(pluginView); |
259 toWebPluginContainerImpl(toPluginView(frameViewBase)); | |
260 WebString text = plugin->plugin()->selectionAsText(); | 259 WebString text = plugin->plugin()->selectionAsText(); |
261 if (!text.isEmpty()) { | 260 if (!text.isEmpty()) { |
262 data.selectedText = text; | 261 data.selectedText = text; |
263 data.editFlags |= WebContextMenuData::CanCopy; | 262 data.editFlags |= WebContextMenuData::CanCopy; |
264 } | 263 } |
265 data.editFlags &= ~WebContextMenuData::CanTranslate; | 264 data.editFlags &= ~WebContextMenuData::CanTranslate; |
266 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); | 265 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); |
267 if (plugin->plugin()->supportsPaginatedPrint()) | 266 if (plugin->plugin()->supportsPaginatedPrint()) |
268 data.mediaFlags |= WebContextMenuData::MediaCanPrint; | 267 data.mediaFlags |= WebContextMenuData::MediaCanPrint; |
269 | 268 |
(...skipping 181 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 |