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

Side by Side Diff: Source/web/WebViewImpl.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/WebViewImpl.h ('k') | public/web/WebContextMenuData.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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3177 // we actually tried to retreive the image. 3177 // we actually tried to retreive the image.
3178 // 3178 //
3179 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving 3179 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving
3180 // to do two hit tests. 3180 // to do two hit tests.
3181 return; 3181 return;
3182 } 3182 }
3183 3183
3184 m_page->mainFrame()->editor().copyImage(result); 3184 m_page->mainFrame()->editor().copyImage(result);
3185 } 3185 }
3186 3186
3187 void WebViewImpl::saveImageAt(const WebPoint& point)
3188 {
3189 if (!m_page)
3190 return;
3191
3192 KURL url = hitTestResultForWindowPos(point).absoluteImageURL();
3193
3194 if (url.isEmpty())
3195 return;
3196
3197 ResourceRequest request(url);
3198 m_page->mainFrame()->loader().client()->loadURLExternally(
3199 request, NavigationPolicyDownloadTo, WebString());
3200 }
3201
3187 void WebViewImpl::dragSourceEndedAt( 3202 void WebViewImpl::dragSourceEndedAt(
3188 const WebPoint& clientPoint, 3203 const WebPoint& clientPoint,
3189 const WebPoint& screenPoint, 3204 const WebPoint& screenPoint,
3190 WebDragOperation operation) 3205 WebDragOperation operation)
3191 { 3206 {
3192 PlatformMouseEvent pme(clientPoint, 3207 PlatformMouseEvent pme(clientPoint,
3193 screenPoint, 3208 screenPoint,
3194 LeftButton, PlatformEvent::MouseMoved, 0, false, fals e, false, 3209 LeftButton, PlatformEvent::MouseMoved, 0, false, fals e, false,
3195 false, 0); 3210 false, 0);
3196 m_page->mainFrame()->eventHandler().dragSourceEndedAt(pme, 3211 m_page->mainFrame()->eventHandler().dragSourceEndedAt(pme,
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4124 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4110 4125
4111 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4126 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4112 return false; 4127 return false;
4113 4128
4114 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4129 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4115 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4130 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4116 } 4131 }
4117 4132
4118 } // namespace blink 4133 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebContextMenuData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698