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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 518043003: Add saveImageFromDataURL() and use it in saveImageAt(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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/WebViewClient.h » ('j') | public/web/WebViewClient.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index fe75efa439e4122e361ec150254cbce64f7698ea..1402991d2b3ad4b3f3c5b109e3c385e99694c093 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -3296,18 +3296,14 @@ void WebViewImpl::copyImageAt(const WebPoint& point)
void WebViewImpl::saveImageAt(const WebPoint& point)
{
- if (!m_page)
+ if (!m_client)
return;
- KURL url = hitTestResultForWindowPos(point).absoluteImageURLIncludingCanvasDataURL();
-
- if (url.isEmpty())
+ Node* node = hitTestResultForWindowPos(point).innerNonSharedNode();
+ if (!node || !(isHTMLCanvasElement(*node) || isHTMLImageElement(*node)))
return;
- ResourceRequest request(url);
- request.setRequestContext(WebURLRequest::RequestContextDownload);
- m_page->deprecatedLocalMainFrame()->loader().client()->loadURLExternally(
- request, NavigationPolicyDownloadTo, WebString());
+ m_client->saveImageFromDataURL(toElement(*node).imageSourceURL());
Justin Novosad 2014/09/03 16:55:29 The name "saveImageFromDataURL" is misleading. The
Ken Russell (switch to Gerrit) 2014/09/04 00:23:10 After considering the various alternatives I think
}
void WebViewImpl::dragSourceEndedAt(
« no previous file with comments | « no previous file | public/web/WebViewClient.h » ('j') | public/web/WebViewClient.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698