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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "core/html/MediaError.h" | 52 #include "core/html/MediaError.h" |
53 #include "core/input/EventHandler.h" | 53 #include "core/input/EventHandler.h" |
54 #include "core/layout/HitTestResult.h" | 54 #include "core/layout/HitTestResult.h" |
55 #include "core/layout/LayoutPart.h" | 55 #include "core/layout/LayoutPart.h" |
56 #include "core/loader/DocumentLoader.h" | 56 #include "core/loader/DocumentLoader.h" |
57 #include "core/loader/FrameLoader.h" | 57 #include "core/loader/FrameLoader.h" |
58 #include "core/loader/HistoryItem.h" | 58 #include "core/loader/HistoryItem.h" |
59 #include "core/page/ContextMenuController.h" | 59 #include "core/page/ContextMenuController.h" |
60 #include "core/page/Page.h" | 60 #include "core/page/Page.h" |
61 #include "platform/ContextMenu.h" | 61 #include "platform/ContextMenu.h" |
62 #include "platform/Widget.h" | 62 #include "platform/FrameViewBase.h" |
63 #include "platform/exported/WrappedResourceResponse.h" | 63 #include "platform/exported/WrappedResourceResponse.h" |
64 #include "platform/text/TextBreakIterator.h" | 64 #include "platform/text/TextBreakIterator.h" |
65 #include "platform/weborigin/KURL.h" | 65 #include "platform/weborigin/KURL.h" |
66 #include "public/platform/WebPoint.h" | 66 #include "public/platform/WebPoint.h" |
67 #include "public/platform/WebString.h" | 67 #include "public/platform/WebString.h" |
68 #include "public/platform/WebURL.h" | 68 #include "public/platform/WebURL.h" |
69 #include "public/platform/WebURLResponse.h" | 69 #include "public/platform/WebURLResponse.h" |
70 #include "public/platform/WebVector.h" | 70 #include "public/platform/WebVector.h" |
71 #include "public/web/WebContextMenuData.h" | 71 #include "public/web/WebContextMenuData.h" |
72 #include "public/web/WebFormElement.h" | 72 #include "public/web/WebFormElement.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // toggling is ignored in that case. | 243 // toggling is ignored in that case. |
244 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && | 244 if (mediaElement->isHTMLVideoElement() && mediaElement->hasVideo() && |
245 !mediaElement->isFullscreen()) | 245 !mediaElement->isFullscreen()) |
246 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; | 246 data.mediaFlags |= WebContextMenuData::MediaCanToggleControls; |
247 if (mediaElement->shouldShowControls()) | 247 if (mediaElement->shouldShowControls()) |
248 data.mediaFlags |= WebContextMenuData::MediaControls; | 248 data.mediaFlags |= WebContextMenuData::MediaControls; |
249 } else if (isHTMLObjectElement(*r.innerNode()) || | 249 } else if (isHTMLObjectElement(*r.innerNode()) || |
250 isHTMLEmbedElement(*r.innerNode())) { | 250 isHTMLEmbedElement(*r.innerNode())) { |
251 LayoutObject* object = r.innerNode()->layoutObject(); | 251 LayoutObject* object = r.innerNode()->layoutObject(); |
252 if (object && object->isLayoutPart()) { | 252 if (object && object->isLayoutPart()) { |
253 Widget* widget = toLayoutPart(object)->widget(); | 253 FrameViewBase* frameViewBase = toLayoutPart(object)->widget(); |
254 if (widget && widget->isPluginContainer()) { | 254 if (frameViewBase && frameViewBase->isPluginContainer()) { |
255 data.mediaType = WebContextMenuData::MediaTypePlugin; | 255 data.mediaType = WebContextMenuData::MediaTypePlugin; |
256 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget); | 256 WebPluginContainerImpl* plugin = |
| 257 toWebPluginContainerImpl(frameViewBase); |
257 WebString text = plugin->plugin()->selectionAsText(); | 258 WebString text = plugin->plugin()->selectionAsText(); |
258 if (!text.isEmpty()) { | 259 if (!text.isEmpty()) { |
259 data.selectedText = text; | 260 data.selectedText = text; |
260 data.editFlags |= WebContextMenuData::CanCopy; | 261 data.editFlags |= WebContextMenuData::CanCopy; |
261 } | 262 } |
262 data.editFlags &= ~WebContextMenuData::CanTranslate; | 263 data.editFlags &= ~WebContextMenuData::CanTranslate; |
263 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); | 264 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition); |
264 if (plugin->plugin()->supportsPaginatedPrint()) | 265 if (plugin->plugin()->supportsPaginatedPrint()) |
265 data.mediaFlags |= WebContextMenuData::MediaCanPrint; | 266 data.mediaFlags |= WebContextMenuData::MediaCanPrint; |
266 | 267 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 subMenuItems.swap(outputItems); | 448 subMenuItems.swap(outputItems); |
448 } | 449 } |
449 | 450 |
450 void ContextMenuClientImpl::populateCustomMenuItems( | 451 void ContextMenuClientImpl::populateCustomMenuItems( |
451 const ContextMenu* defaultMenu, | 452 const ContextMenu* defaultMenu, |
452 WebContextMenuData* data) { | 453 WebContextMenuData* data) { |
453 populateSubMenuItems(defaultMenu->items(), data->customItems); | 454 populateSubMenuItems(defaultMenu->items(), data->customItems); |
454 } | 455 } |
455 | 456 |
456 } // namespace blink | 457 } // namespace blink |
OLD | NEW |