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

Unified Diff: Source/web/ContextMenuClientImpl.cpp

Issue 334243004: Use suggested filename for "Save Link As" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | public/web/WebContextMenuData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/ContextMenuClientImpl.cpp
diff --git a/Source/web/ContextMenuClientImpl.cpp b/Source/web/ContextMenuClientImpl.cpp
index 8d61b79c6601697230ff3900a89c436deaa764ea..f2d2191c159fcebfef2cd71eccce06d953138d12 100644
--- a/Source/web/ContextMenuClientImpl.cpp
+++ b/Source/web/ContextMenuClientImpl.cpp
@@ -43,6 +43,7 @@
#include "core/frame/FrameView.h"
#include "core/frame/PinchViewport.h"
#include "core/frame/Settings.h"
+#include "core/html/HTMLAnchorElement.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLMediaElement.h"
@@ -371,6 +372,12 @@ void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
// Filter out custom menu elements and add them into the data.
populateCustomMenuItems(defaultMenu, &data);
+ // Extract suggested filename for saving file.
+ if (isHTMLAnchorElement(r.URLElement())) {
+ HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement());
+ data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAttr);
+ }
abarth-chromium 2014/06/18 23:38:48 Why not put this information in WebCore::ContextMe
asanka 2014/06/19 21:22:19 As in, eliminate WebContextMenuData?
+
data.node = r.innerNonSharedNode();
WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedFrame);
« no previous file with comments | « no previous file | public/web/WebContextMenuData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698