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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if (mediaElement->supportsSave()) | 251 if (mediaElement->supportsSave()) |
252 data.mediaFlags |= WebContextMenuData::MediaCanSave; | 252 data.mediaFlags |= WebContextMenuData::MediaCanSave; |
253 if (mediaElement->hasAudio()) | 253 if (mediaElement->hasAudio()) |
254 data.mediaFlags |= WebContextMenuData::MediaHasAudio; | 254 data.mediaFlags |= WebContextMenuData::MediaHasAudio; |
255 // Media controls can be toggled only for video player. If we toggle | 255 // Media controls can be toggled only for video player. If we toggle |
256 // controls for audio then the player disappears, and there is no way to | 256 // controls for audio then the player disappears, and there is no way to |
257 // return it back. Don't set this bit for fullscreen video, since | 257 // return it back. Don't set this bit for fullscreen video, since |
258 // toggling is ignored in that case. | 258 // toggling is ignored in that case. |
259 if (mediaElement->hasVideo() && !mediaElement->isFullscreen()) | 259 if (mediaElement->hasVideo() && !mediaElement->isFullscreen()) |
260 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; | 260 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; |
261 if (mediaElement->controls()) | 261 if (mediaElement->shouldShowControls()) |
262 data.mediaFlags |= WebContextMenuData::MediaControls; | 262 data.mediaFlags |= WebContextMenuData::MediaControls; |
263 } else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElemen
t(*r.innerNonSharedNode())) { | 263 } else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElemen
t(*r.innerNonSharedNode())) { |
264 RenderObject* object = r.innerNonSharedNode()->renderer(); | 264 RenderObject* object = r.innerNonSharedNode()->renderer(); |
265 if (object && object->isWidget()) { | 265 if (object && object->isWidget()) { |
266 Widget* widget = toRenderWidget(object)->widget(); | 266 Widget* widget = toRenderWidget(object)->widget(); |
267 if (widget && widget->isPluginContainer()) { | 267 if (widget && widget->isPluginContainer()) { |
268 data.mediaType = WebContextMenuData::MediaTypePlugin; | 268 data.mediaType = WebContextMenuData::MediaTypePlugin; |
269 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget
); | 269 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget
); |
270 WebString text = plugin->plugin()->selectionAsText(); | 270 WebString text = plugin->plugin()->selectionAsText(); |
271 if (!text.isEmpty()) { | 271 if (!text.isEmpty()) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 outputItems[i] = subItems[i]; | 433 outputItems[i] = subItems[i]; |
434 subMenuItems.swap(outputItems); | 434 subMenuItems.swap(outputItems); |
435 } | 435 } |
436 | 436 |
437 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 437 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
438 { | 438 { |
439 populateSubMenuItems(defaultMenu->items(), data->customItems); | 439 populateSubMenuItems(defaultMenu->items(), data->customItems); |
440 } | 440 } |
441 | 441 |
442 } // namespace blink | 442 } // namespace blink |
OLD | NEW |