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

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 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { 1717 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() {
1717 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); 1718 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId);
1718 return new WebStorageNamespaceImpl(session_storage_namespace_id_); 1719 return new WebStorageNamespaceImpl(session_storage_namespace_id_);
1719 } 1720 }
1720 1721
1721 void RenderViewImpl::printPage(WebLocalFrame* frame) { 1722 void RenderViewImpl::printPage(WebLocalFrame* frame) {
1722 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 1723 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
1723 PrintPage(frame, handling_input_event_)); 1724 PrintPage(frame, handling_input_event_));
1724 } 1725 }
1725 1726
1727 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) {
1728 // Note: We should basically send GURL but we use size-limited string instead
1729 // in order to send a larger data url to save a image for <canvas> or <img>.
1730 if (data_url.length() < kMaxLengthOfDataURLString)
1731 Send(new ViewHostMsg_SaveImageFromDataURL(routing_id_, data_url.utf8()));
1732 }
1733
1726 bool RenderViewImpl::enumerateChosenDirectory( 1734 bool RenderViewImpl::enumerateChosenDirectory(
1727 const WebString& path, 1735 const WebString& path,
1728 WebFileChooserCompletion* chooser_completion) { 1736 WebFileChooserCompletion* chooser_completion) {
1729 int id = enumeration_completion_id_++; 1737 int id = enumeration_completion_id_++;
1730 enumeration_completions_[id] = chooser_completion; 1738 enumeration_completions_[id] = chooser_completion;
1731 return Send(new ViewHostMsg_EnumerateDirectory( 1739 return Send(new ViewHostMsg_EnumerateDirectory(
1732 routing_id_, 1740 routing_id_,
1733 id, 1741 id,
1734 base::FilePath::FromUTF16Unsafe(path))); 1742 base::FilePath::FromUTF16Unsafe(path)));
1735 } 1743 }
(...skipping 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after
4194 std::vector<gfx::Size> sizes; 4202 std::vector<gfx::Size> sizes;
4195 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4203 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4196 if (!url.isEmpty()) 4204 if (!url.isEmpty())
4197 urls.push_back( 4205 urls.push_back(
4198 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4206 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4199 } 4207 }
4200 SendUpdateFaviconURL(urls); 4208 SendUpdateFaviconURL(urls);
4201 } 4209 }
4202 4210
4203 } // namespace content 4211 } // 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