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

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

Issue 1876653003: Register clipboard image blob in the browser process to copy data less. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 | « content/renderer/renderer_clipboard_delegate.h ('k') | content/renderer/webclipboard_impl.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 // 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 // This file provides the embedder's side of the Clipboard interface. 5 // This file provides the embedder's side of the Clipboard interface.
6 6
7 #include "content/renderer/renderer_clipboard_delegate.h" 7 #include "content/renderer/renderer_clipboard_delegate.h"
8 8
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/numerics/safe_math.h" 10 #include "base/numerics/safe_math.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadHTML( 62 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadHTML(
63 type, markup, url, fragment_start, fragment_end)); 63 type, markup, url, fragment_start, fragment_end));
64 } 64 }
65 65
66 void RendererClipboardDelegate::ReadRTF(ui::ClipboardType type, 66 void RendererClipboardDelegate::ReadRTF(ui::ClipboardType type,
67 std::string* result) { 67 std::string* result) {
68 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadRTF(type, result)); 68 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadRTF(type, result));
69 } 69 }
70 70
71 void RendererClipboardDelegate::ReadImage(ui::ClipboardType type, 71 void RendererClipboardDelegate::ReadImage(ui::ClipboardType type,
72 std::string* data) { 72 std::string* blob_uuid,
73 base::SharedMemoryHandle image_handle; 73 std::string* mime_type,
74 uint32_t image_size = 0; 74 int64_t* size) {
75 RenderThreadImpl::current()->Send( 75 RenderThreadImpl::current()->Send(
76 new ClipboardHostMsg_ReadImage(type, &image_handle, &image_size)); 76 new ClipboardHostMsg_ReadImage(type, blob_uuid, mime_type, size));
77 if (base::SharedMemory::IsHandleValid(image_handle)) {
78 base::SharedMemory buffer(image_handle, true);
79 buffer.Map(image_size);
80 data->append(static_cast<char*>(buffer.memory()), image_size);
81 }
82 } 77 }
83 78
84 void RendererClipboardDelegate::ReadCustomData(ui::ClipboardType clipboard_type, 79 void RendererClipboardDelegate::ReadCustomData(ui::ClipboardType clipboard_type,
85 const base::string16& type, 80 const base::string16& type,
86 base::string16* data) { 81 base::string16* data) {
87 RenderThreadImpl::current()->Send( 82 RenderThreadImpl::current()->Send(
88 new ClipboardHostMsg_ReadCustomData(clipboard_type, type, data)); 83 new ClipboardHostMsg_ReadCustomData(clipboard_type, type, data));
89 } 84 }
90 85
91 void RendererClipboardDelegate::WriteText(ui::ClipboardType clipboard_type, 86 void RendererClipboardDelegate::WriteText(ui::ClipboardType clipboard_type,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 clipboard_type, size, shared_buf->handle())); 153 clipboard_type, size, shared_buf->handle()));
159 return true; 154 return true;
160 } 155 }
161 156
162 void RendererClipboardDelegate::CommitWrite(ui::ClipboardType clipboard_type) { 157 void RendererClipboardDelegate::CommitWrite(ui::ClipboardType clipboard_type) {
163 RenderThreadImpl::current()->Send( 158 RenderThreadImpl::current()->Send(
164 new ClipboardHostMsg_CommitWrite(clipboard_type)); 159 new ClipboardHostMsg_CommitWrite(clipboard_type));
165 } 160 }
166 161
167 } // namespace content 162 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_clipboard_delegate.h ('k') | content/renderer/webclipboard_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698