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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 data.mediaFlags |= WebContextMenuData::MediaHasAudio; | 264 data.mediaFlags |= WebContextMenuData::MediaHasAudio; |
265 // Media controls can be toggled only for video player. If we toggle | 265 // Media controls can be toggled only for video player. If we toggle |
266 // controls for audio then the player disappears, and there is no way to | 266 // controls for audio then the player disappears, and there is no way to |
267 // return it back. Don't set this bit for fullscreen video, since | 267 // return it back. Don't set this bit for fullscreen video, since |
268 // toggling is ignored in that case. | 268 // toggling is ignored in that case. |
269 if (mediaElement->hasVideo() && !mediaElement->isFullscreen()) | 269 if (mediaElement->hasVideo() && !mediaElement->isFullscreen()) |
270 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; | 270 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; |
271 if (mediaElement->shouldShowControls()) | 271 if (mediaElement->shouldShowControls()) |
272 data.mediaFlags |= WebContextMenuData::MediaControls; | 272 data.mediaFlags |= WebContextMenuData::MediaControls; |
273 } else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElemen
t(*r.innerNonSharedNode())) { | 273 } else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElemen
t(*r.innerNonSharedNode())) { |
274 RenderObject* object = r.innerNonSharedNode()->renderer(); | 274 LayoutObject* object = r.innerNonSharedNode()->renderer(); |
275 if (object && object->isRenderPart()) { | 275 if (object && object->isRenderPart()) { |
276 Widget* widget = toRenderPart(object)->widget(); | 276 Widget* widget = toRenderPart(object)->widget(); |
277 if (widget && widget->isPluginContainer()) { | 277 if (widget && widget->isPluginContainer()) { |
278 data.mediaType = WebContextMenuData::MediaTypePlugin; | 278 data.mediaType = WebContextMenuData::MediaTypePlugin; |
279 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget
); | 279 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget
); |
280 WebString text = plugin->plugin()->selectionAsText(); | 280 WebString text = plugin->plugin()->selectionAsText(); |
281 if (!text.isEmpty()) { | 281 if (!text.isEmpty()) { |
282 data.selectedText = text; | 282 data.selectedText = text; |
283 data.editFlags |= WebContextMenuData::CanCopy; | 283 data.editFlags |= WebContextMenuData::CanCopy; |
284 } | 284 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 outputItems[i] = subItems[i]; | 439 outputItems[i] = subItems[i]; |
440 subMenuItems.swap(outputItems); | 440 subMenuItems.swap(outputItems); |
441 } | 441 } |
442 | 442 |
443 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) | 443 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) |
444 { | 444 { |
445 populateSubMenuItems(defaultMenu->items(), data->customItems); | 445 populateSubMenuItems(defaultMenu->items(), data->customItems); |
446 } | 446 } |
447 | 447 |
448 } // namespace blink | 448 } // namespace blink |
OLD | NEW |