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

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
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 3135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3146 // we actually tried to retreive the image. 3146 // we actually tried to retreive the image.
3147 // 3147 //
3148 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving 3148 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving
3149 // to do two hit tests. 3149 // to do two hit tests.
3150 return; 3150 return;
3151 } 3151 }
3152 3152
3153 m_page->mainFrame()->editor().copyImage(result); 3153 m_page->mainFrame()->editor().copyImage(result);
3154 } 3154 }
3155 3155
3156 void WebViewImpl::saveImageAt(const WebPoint& point)
3157 {
3158 if (!m_page)
3159 return;
3160
3161 KURL url = hitTestResultForWindowPos(point).absoluteImageURL();
3162
3163 if (url.isEmpty())
3164 return;
3165
3166 ResourceRequest request(url);
3167 m_page->mainFrame()->loader().client()->loadURLExternally(
3168 request, NavigationPolicyDownloadTo, WebString());
3169 }
3170
3156 void WebViewImpl::dragSourceEndedAt( 3171 void WebViewImpl::dragSourceEndedAt(
3157 const WebPoint& clientPoint, 3172 const WebPoint& clientPoint,
3158 const WebPoint& screenPoint, 3173 const WebPoint& screenPoint,
3159 WebDragOperation operation) 3174 WebDragOperation operation)
3160 { 3175 {
3161 PlatformMouseEvent pme(clientPoint, 3176 PlatformMouseEvent pme(clientPoint,
3162 screenPoint, 3177 screenPoint,
3163 LeftButton, PlatformEvent::MouseMoved, 0, false, fals e, false, 3178 LeftButton, PlatformEvent::MouseMoved, 0, false, fals e, false,
3164 false, 0); 3179 false, 0);
3165 m_page->mainFrame()->eventHandler().dragSourceEndedAt(pme, 3180 m_page->mainFrame()->eventHandler().dragSourceEndedAt(pme,
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
4075 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4090 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4076 4091
4077 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4092 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4078 return false; 4093 return false;
4079 4094
4080 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4095 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4081 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4096 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4082 } 4097 }
4083 4098
4084 } // namespace blink 4099 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698