| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "core/frame/FrameView.h" | 44 #include "core/frame/FrameView.h" |
| 45 #include "core/frame/PinchViewport.h" | 45 #include "core/frame/PinchViewport.h" |
| 46 #include "core/frame/Settings.h" | 46 #include "core/frame/Settings.h" |
| 47 #include "core/html/HTMLAnchorElement.h" | 47 #include "core/html/HTMLAnchorElement.h" |
| 48 #include "core/html/HTMLFormElement.h" | 48 #include "core/html/HTMLFormElement.h" |
| 49 #include "core/html/HTMLInputElement.h" | 49 #include "core/html/HTMLInputElement.h" |
| 50 #include "core/html/HTMLMediaElement.h" | 50 #include "core/html/HTMLMediaElement.h" |
| 51 #include "core/html/HTMLPlugInElement.h" | 51 #include "core/html/HTMLPlugInElement.h" |
| 52 #include "core/html/MediaError.h" | 52 #include "core/html/MediaError.h" |
| 53 #include "core/layout/HitTestResult.h" | 53 #include "core/layout/HitTestResult.h" |
| 54 #include "core/layout/LayoutPart.h" |
| 54 #include "core/loader/DocumentLoader.h" | 55 #include "core/loader/DocumentLoader.h" |
| 55 #include "core/loader/FrameLoader.h" | 56 #include "core/loader/FrameLoader.h" |
| 56 #include "core/loader/HistoryItem.h" | 57 #include "core/loader/HistoryItem.h" |
| 57 #include "core/page/ContextMenuController.h" | 58 #include "core/page/ContextMenuController.h" |
| 58 #include "core/page/EventHandler.h" | 59 #include "core/page/EventHandler.h" |
| 59 #include "core/page/Page.h" | 60 #include "core/page/Page.h" |
| 60 #include "core/rendering/RenderPart.h" | |
| 61 #include "platform/ContextMenu.h" | 61 #include "platform/ContextMenu.h" |
| 62 #include "platform/Widget.h" | 62 #include "platform/Widget.h" |
| 63 #include "platform/text/TextBreakIterator.h" | 63 #include "platform/text/TextBreakIterator.h" |
| 64 #include "platform/weborigin/KURL.h" | 64 #include "platform/weborigin/KURL.h" |
| 65 #include "public/platform/WebPoint.h" | 65 #include "public/platform/WebPoint.h" |
| 66 #include "public/platform/WebString.h" | 66 #include "public/platform/WebString.h" |
| 67 #include "public/platform/WebURL.h" | 67 #include "public/platform/WebURL.h" |
| 68 #include "public/platform/WebURLResponse.h" | 68 #include "public/platform/WebURLResponse.h" |
| 69 #include "public/platform/WebVector.h" | 69 #include "public/platform/WebVector.h" |
| 70 #include "public/web/WebContextMenuData.h" | 70 #include "public/web/WebContextMenuData.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 LayoutObject* object = r.innerNonSharedNode()->renderer(); | 274 LayoutObject* object = r.innerNonSharedNode()->renderer(); |
| 275 if (object && object->isRenderPart()) { | 275 if (object && object->isLayoutPart()) { |
| 276 Widget* widget = toRenderPart(object)->widget(); | 276 Widget* widget = toLayoutPart(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 } |
| 285 data.editFlags &= ~WebContextMenuData::CanTranslate; | 285 data.editFlags &= ~WebContextMenuData::CanTranslate; |
| 286 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePositi
on); | 286 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePositi
on); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 outputItems[i] = subItems[i]; | 444 outputItems[i] = subItems[i]; |
| 445 subMenuItems.swap(outputItems); | 445 subMenuItems.swap(outputItems); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) | 448 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) |
| 449 { | 449 { |
| 450 populateSubMenuItems(defaultMenu->items(), data->customItems); | 450 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 451 } | 451 } |
| 452 | 452 |
| 453 } // namespace blink | 453 } // namespace blink |
| OLD | NEW |