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

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: 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') | public/web/WebContextMenuData.h » ('J')
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..39e4203692c6e1a692508deb196adf131ee42391 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
Inactive 2014/06/18 12:37:54 nit: please end comments with a period '.'
Nikhil 2014/06/18 13:51:33 Done.
+ if (isHTMLAnchorElement(r.URLElement())) {
+ HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement());
+ data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAttr);
+ }
+
data.node = r.innerNonSharedNode();
WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedFrame);
« no previous file with comments | « no previous file | public/web/WebContextMenuData.h » ('j') | public/web/WebContextMenuData.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698