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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 518693002: Fix a crash when saving a <canvas> or <img> image which is large. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { 1714 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() {
1715 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); 1715 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId);
1716 return new WebStorageNamespaceImpl(session_storage_namespace_id_); 1716 return new WebStorageNamespaceImpl(session_storage_namespace_id_);
1717 } 1717 }
1718 1718
1719 void RenderViewImpl::printPage(WebLocalFrame* frame) { 1719 void RenderViewImpl::printPage(WebLocalFrame* frame) {
1720 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 1720 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
1721 PrintPage(frame, handling_input_event_)); 1721 PrintPage(frame, handling_input_event_));
1722 } 1722 }
1723 1723
1724 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) {
1725 // Note: We should basically send GURL but we use size-limited string instead
1726 // in order to send a larger data url to save a image for <canvas> or <img>.
1727 const int MAX_LENGTH_OF_DATA_URL = 1024 * 1024 * 10;
palmer 2014/09/02 17:58:04 Yeah, define this in 1 canonical place. The 2 decl
1728 if (data_url.length() < MAX_LENGTH_OF_DATA_URL)
1729 Send(new ViewHostMsg_SaveImageFromDataURL(routing_id_, data_url.utf8()));
1730 }
1731
1724 bool RenderViewImpl::enumerateChosenDirectory( 1732 bool RenderViewImpl::enumerateChosenDirectory(
1725 const WebString& path, 1733 const WebString& path,
1726 WebFileChooserCompletion* chooser_completion) { 1734 WebFileChooserCompletion* chooser_completion) {
1727 int id = enumeration_completion_id_++; 1735 int id = enumeration_completion_id_++;
1728 enumeration_completions_[id] = chooser_completion; 1736 enumeration_completions_[id] = chooser_completion;
1729 return Send(new ViewHostMsg_EnumerateDirectory( 1737 return Send(new ViewHostMsg_EnumerateDirectory(
1730 routing_id_, 1738 routing_id_,
1731 id, 1739 id,
1732 base::FilePath::FromUTF16Unsafe(path))); 1740 base::FilePath::FromUTF16Unsafe(path)));
1733 } 1741 }
(...skipping 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 std::vector<gfx::Size> sizes; 4208 std::vector<gfx::Size> sizes;
4201 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4209 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4202 if (!url.isEmpty()) 4210 if (!url.isEmpty())
4203 urls.push_back( 4211 urls.push_back(
4204 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4212 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4205 } 4213 }
4206 SendUpdateFaviconURL(urls); 4214 SendUpdateFaviconURL(urls);
4207 } 4215 }
4208 4216
4209 } // namespace content 4217 } // namespace content
OLDNEW
« content/common/view_messages.h ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698