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

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 22 matching lines...) Expand all
33 #include "base/strings/utf_string_conversions.h" 33 #include "base/strings/utf_string_conversions.h"
34 #include "base/time/time.h" 34 #include "base/time/time.h"
35 #include "cc/base/switches.h" 35 #include "cc/base/switches.h"
36 #include "content/child/appcache/appcache_dispatcher.h" 36 #include "content/child/appcache/appcache_dispatcher.h"
37 #include "content/child/appcache/web_application_cache_host_impl.h" 37 #include "content/child/appcache/web_application_cache_host_impl.h"
38 #include "content/child/child_shared_bitmap_manager.h" 38 #include "content/child/child_shared_bitmap_manager.h"
39 #include "content/child/child_thread.h" 39 #include "content/child/child_thread.h"
40 #include "content/child/npapi/webplugin_delegate_impl.h" 40 #include "content/child/npapi/webplugin_delegate_impl.h"
41 #include "content/child/request_extra_data.h" 41 #include "content/child/request_extra_data.h"
42 #include "content/child/webmessageportchannel_impl.h" 42 #include "content/child/webmessageportchannel_impl.h"
43 #include "content/common/content_constants_internal.h"
43 #include "content/common/database_messages.h" 44 #include "content/common/database_messages.h"
44 #include "content/common/dom_storage/dom_storage_types.h" 45 #include "content/common/dom_storage/dom_storage_types.h"
45 #include "content/common/drag_messages.h" 46 #include "content/common/drag_messages.h"
46 #include "content/common/frame_messages.h" 47 #include "content/common/frame_messages.h"
47 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 48 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
48 #include "content/common/input_messages.h" 49 #include "content/common/input_messages.h"
49 #include "content/common/pepper_messages.h" 50 #include "content/common/pepper_messages.h"
50 #include "content/common/socket_stream_handle_data.h" 51 #include "content/common/socket_stream_handle_data.h"
51 #include "content/common/ssl_status_serialization.h" 52 #include "content/common/ssl_status_serialization.h"
52 #include "content/common/view_messages.h" 53 #include "content/common/view_messages.h"
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { 1715 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() {
1715 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); 1716 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId);
1716 return new WebStorageNamespaceImpl(session_storage_namespace_id_); 1717 return new WebStorageNamespaceImpl(session_storage_namespace_id_);
1717 } 1718 }
1718 1719
1719 void RenderViewImpl::printPage(WebLocalFrame* frame) { 1720 void RenderViewImpl::printPage(WebLocalFrame* frame) {
1720 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 1721 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
1721 PrintPage(frame, handling_input_event_)); 1722 PrintPage(frame, handling_input_event_));
1722 } 1723 }
1723 1724
1725 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) {
1726 // Note: We should basically send GURL but we use size-limited string instead
1727 // in order to send a larger data url to save a image for <canvas> or <img>.
Ken Russell (switch to Gerrit) 2014/09/04 00:23:26 Assuming the code change I suggest is made, this c
1728 if (data_url.length() < kMaxLengthOfDataURLString)
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 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
4191 std::vector<gfx::Size> sizes; 4199 std::vector<gfx::Size> sizes;
4192 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4200 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4193 if (!url.isEmpty()) 4201 if (!url.isEmpty())
4194 urls.push_back( 4202 urls.push_back(
4195 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4203 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4196 } 4204 }
4197 SendUpdateFaviconURL(urls); 4205 SendUpdateFaviconURL(urls);
4198 } 4206 }
4199 4207
4200 } // namespace content 4208 } // namespace content
OLDNEW
« content/renderer/render_view_browsertest.cc ('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