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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/css/CSSStyleDeclaration.h" | 47 #include "core/css/CSSStyleDeclaration.h" |
48 #include "core/dom/Document.h" | 48 #include "core/dom/Document.h" |
49 #include "core/dom/DocumentMarkerController.h" | 49 #include "core/dom/DocumentMarkerController.h" |
50 #include "core/dom/ExceptionCodePlaceholder.h" | 50 #include "core/dom/ExceptionCodePlaceholder.h" |
51 #include "core/editing/Editor.h" | 51 #include "core/editing/Editor.h" |
52 #include "core/history/HistoryItem.h" | 52 #include "core/history/HistoryItem.h" |
53 #include "core/html/HTMLFormElement.h" | 53 #include "core/html/HTMLFormElement.h" |
54 #include "core/html/HTMLInputElement.h" | 54 #include "core/html/HTMLInputElement.h" |
55 #include "core/html/HTMLMediaElement.h" | 55 #include "core/html/HTMLMediaElement.h" |
56 #include "core/html/HTMLPlugInImageElement.h" | 56 #include "core/html/HTMLPlugInImageElement.h" |
| 57 #include "core/html/HTMLVideoElement.h" |
57 #include "core/html/MediaError.h" | 58 #include "core/html/MediaError.h" |
58 #include "core/loader/DocumentLoader.h" | 59 #include "core/loader/DocumentLoader.h" |
59 #include "core/loader/FrameLoader.h" | 60 #include "core/loader/FrameLoader.h" |
60 #include "core/page/ContextMenuController.h" | 61 #include "core/page/ContextMenuController.h" |
61 #include "core/page/EventHandler.h" | 62 #include "core/page/EventHandler.h" |
62 #include "core/page/FrameView.h" | 63 #include "core/page/FrameView.h" |
63 #include "core/page/Page.h" | 64 #include "core/page/Page.h" |
64 #include "core/page/Settings.h" | 65 #include "core/page/Settings.h" |
65 #include "core/platform/ContextMenu.h" | 66 #include "core/platform/ContextMenu.h" |
66 #include "core/platform/Widget.h" | 67 #include "core/platform/Widget.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (!r.absoluteImageURL().isEmpty()) { | 215 if (!r.absoluteImageURL().isEmpty()) { |
215 data.srcURL = r.absoluteImageURL(); | 216 data.srcURL = r.absoluteImageURL(); |
216 data.mediaType = WebContextMenuData::MediaTypeImage; | 217 data.mediaType = WebContextMenuData::MediaTypeImage; |
217 } else if (!r.absoluteMediaURL().isEmpty()) { | 218 } else if (!r.absoluteMediaURL().isEmpty()) { |
218 data.srcURL = r.absoluteMediaURL(); | 219 data.srcURL = r.absoluteMediaURL(); |
219 | 220 |
220 // We know that if absoluteMediaURL() is not empty, then this | 221 // We know that if absoluteMediaURL() is not empty, then this |
221 // is a media element. | 222 // is a media element. |
222 HTMLMediaElement* mediaElement = | 223 HTMLMediaElement* mediaElement = |
223 toMediaElement(r.innerNonSharedNode()); | 224 toMediaElement(r.innerNonSharedNode()); |
224 if (mediaElement->hasTagName(HTMLNames::videoTag)) | 225 if (isHTMLVideoElement(mediaElement)) |
225 data.mediaType = WebContextMenuData::MediaTypeVideo; | 226 data.mediaType = WebContextMenuData::MediaTypeVideo; |
226 else if (mediaElement->hasTagName(HTMLNames::audioTag)) | 227 else if (mediaElement->hasTagName(HTMLNames::audioTag)) |
227 data.mediaType = WebContextMenuData::MediaTypeAudio; | 228 data.mediaType = WebContextMenuData::MediaTypeAudio; |
228 | 229 |
229 if (mediaElement->error()) | 230 if (mediaElement->error()) |
230 data.mediaFlags |= WebContextMenuData::MediaInError; | 231 data.mediaFlags |= WebContextMenuData::MediaInError; |
231 if (mediaElement->paused()) | 232 if (mediaElement->paused()) |
232 data.mediaFlags |= WebContextMenuData::MediaPaused; | 233 data.mediaFlags |= WebContextMenuData::MediaPaused; |
233 if (mediaElement->muted()) | 234 if (mediaElement->muted()) |
234 data.mediaFlags |= WebContextMenuData::MediaMuted; | 235 data.mediaFlags |= WebContextMenuData::MediaMuted; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 outputItems[i] = subItems[i]; | 403 outputItems[i] = subItems[i]; |
403 subMenuItems.swap(outputItems); | 404 subMenuItems.swap(outputItems); |
404 } | 405 } |
405 | 406 |
406 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 407 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
407 { | 408 { |
408 populateSubMenuItems(defaultMenu->items(), data->customItems); | 409 populateSubMenuItems(defaultMenu->items(), data->customItems); |
409 } | 410 } |
410 | 411 |
411 } // namespace WebKit | 412 } // namespace WebKit |
OLD | NEW |