Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: Source/web/ContextMenuClientImpl.cpp

Issue 18205009: Introduce isHTMLVideoElement and toHTMLVideoElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderVideo.cpp ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderVideo.cpp ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698