| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (mediaElement->paused()) | 235 if (mediaElement->paused()) |
| 236 data.mediaFlags |= WebContextMenuData::MediaPaused; | 236 data.mediaFlags |= WebContextMenuData::MediaPaused; |
| 237 if (mediaElement->muted()) | 237 if (mediaElement->muted()) |
| 238 data.mediaFlags |= WebContextMenuData::MediaMuted; | 238 data.mediaFlags |= WebContextMenuData::MediaMuted; |
| 239 if (mediaElement->loop()) | 239 if (mediaElement->loop()) |
| 240 data.mediaFlags |= WebContextMenuData::MediaLoop; | 240 data.mediaFlags |= WebContextMenuData::MediaLoop; |
| 241 if (mediaElement->supportsSave()) | 241 if (mediaElement->supportsSave()) |
| 242 data.mediaFlags |= WebContextMenuData::MediaCanSave; | 242 data.mediaFlags |= WebContextMenuData::MediaCanSave; |
| 243 if (mediaElement->hasAudio()) | 243 if (mediaElement->hasAudio()) |
| 244 data.mediaFlags |= WebContextMenuData::MediaHasAudio; | 244 data.mediaFlags |= WebContextMenuData::MediaHasAudio; |
| 245 if (mediaElement->hasVideo()) | 245 // Media controls can be toggled only for video player. If we toggle |
| 246 data.mediaFlags |= WebContextMenuData::MediaHasVideo; | 246 // controls for audio then the player disappears, and there is no way to |
| 247 // return it back. Don't set this bit for fullscreen video, since |
| 248 // toggling is ignored in that case. |
| 249 if (mediaElement->hasVideo() && !mediaElement->isFullscreen()) |
| 250 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; |
| 247 if (mediaElement->controls()) | 251 if (mediaElement->controls()) |
| 248 data.mediaFlags |= WebContextMenuData::MediaControls; | 252 data.mediaFlags |= WebContextMenuData::MediaControls; |
| 249 } else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElemen
t(*r.innerNonSharedNode())) { | 253 } else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElemen
t(*r.innerNonSharedNode())) { |
| 250 RenderObject* object = r.innerNonSharedNode()->renderer(); | 254 RenderObject* object = r.innerNonSharedNode()->renderer(); |
| 251 if (object && object->isWidget()) { | 255 if (object && object->isWidget()) { |
| 252 Widget* widget = toRenderWidget(object)->widget(); | 256 Widget* widget = toRenderWidget(object)->widget(); |
| 253 if (widget && widget->isPluginContainer()) { | 257 if (widget && widget->isPluginContainer()) { |
| 254 data.mediaType = WebContextMenuData::MediaTypePlugin; | 258 data.mediaType = WebContextMenuData::MediaTypePlugin; |
| 255 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget
); | 259 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget
); |
| 256 WebString text = plugin->plugin()->selectionAsText(); | 260 WebString text = plugin->plugin()->selectionAsText(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 outputItems[i] = subItems[i]; | 420 outputItems[i] = subItems[i]; |
| 417 subMenuItems.swap(outputItems); | 421 subMenuItems.swap(outputItems); |
| 418 } | 422 } |
| 419 | 423 |
| 420 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 424 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
| 421 { | 425 { |
| 422 populateSubMenuItems(defaultMenu->items(), data->customItems); | 426 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 423 } | 427 } |
| 424 | 428 |
| 425 } // namespace blink | 429 } // namespace blink |
| OLD | NEW |