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

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

Issue 255563004: Implement "Save image as" for canvas (blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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/web/AssertMatchingEnums.cpp ('k') | Source/web/WebViewImpl.h » ('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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete()) 208 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete())
209 data.editFlags |= WebContextMenuData::CanDelete; 209 data.editFlags |= WebContextMenuData::CanDelete;
210 // We can always select all... 210 // We can always select all...
211 data.editFlags |= WebContextMenuData::CanSelectAll; 211 data.editFlags |= WebContextMenuData::CanSelectAll;
212 data.editFlags |= WebContextMenuData::CanTranslate; 212 data.editFlags |= WebContextMenuData::CanTranslate;
213 213
214 // Links, Images, Media tags, and Image/Media-Links take preference over 214 // Links, Images, Media tags, and Image/Media-Links take preference over
215 // all else. 215 // all else.
216 data.linkURL = r.absoluteLinkURL(); 216 data.linkURL = r.absoluteLinkURL();
217 217
218 if (!r.absoluteImageURL().isEmpty()) { 218 if (isHTMLCanvasElement(r.innerNonSharedNode())) {
219 data.mediaType = WebContextMenuData::MediaTypeCanvas;
220 } else if (!r.absoluteImageURL().isEmpty()) {
219 data.srcURL = r.absoluteImageURL(); 221 data.srcURL = r.absoluteImageURL();
220 data.mediaType = WebContextMenuData::MediaTypeImage; 222 data.mediaType = WebContextMenuData::MediaTypeImage;
221 data.mediaFlags |= WebContextMenuData::MediaCanPrint; 223 data.mediaFlags |= WebContextMenuData::MediaCanPrint;
222 } else if (!r.absoluteMediaURL().isEmpty()) { 224 } else if (!r.absoluteMediaURL().isEmpty()) {
223 data.srcURL = r.absoluteMediaURL(); 225 data.srcURL = r.absoluteMediaURL();
224 226
225 // We know that if absoluteMediaURL() is not empty, then this 227 // We know that if absoluteMediaURL() is not empty, then this
226 // is a media element. 228 // is a media element.
227 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNonSharedNode ()); 229 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNonSharedNode ());
228 if (isHTMLVideoElement(*mediaElement)) 230 if (isHTMLVideoElement(*mediaElement))
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 outputItems[i] = subItems[i]; 419 outputItems[i] = subItems[i];
418 subMenuItems.swap(outputItems); 420 subMenuItems.swap(outputItems);
419 } 421 }
420 422
421 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) 423 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
422 { 424 {
423 populateSubMenuItems(defaultMenu->items(), data->customItems); 425 populateSubMenuItems(defaultMenu->items(), data->customItems);
424 } 426 }
425 427
426 } // namespace blink 428 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/AssertMatchingEnums.cpp ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698