| OLD | NEW |
| 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 random webkit glue functions. | 5 // This file provides the embedder's side of random webkit glue functions. |
| 6 | 6 |
| 7 #include "content/renderer/renderer_clipboard_client.h" | 7 #include "content/renderer/renderer_clipboard_client.h" |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 void RendererClipboardClient::ReadHTML(ui::Clipboard::Buffer buffer, | 152 void RendererClipboardClient::ReadHTML(ui::Clipboard::Buffer buffer, |
| 153 string16* markup, | 153 string16* markup, |
| 154 GURL* url, uint32* fragment_start, | 154 GURL* url, uint32* fragment_start, |
| 155 uint32* fragment_end) { | 155 uint32* fragment_end) { |
| 156 RenderThreadImpl::current()->Send( | 156 RenderThreadImpl::current()->Send( |
| 157 new ClipboardHostMsg_ReadHTML(buffer, markup, url, fragment_start, | 157 new ClipboardHostMsg_ReadHTML(buffer, markup, url, fragment_start, |
| 158 fragment_end)); | 158 fragment_end)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void RendererClipboardClient::ReadRTF(ui::Clipboard::Buffer buffer, |
| 162 std::string* result) { |
| 163 RenderThreadImpl::current()->Send( |
| 164 new ClipboardHostMsg_ReadRTF(buffer, result)); |
| 165 } |
| 166 |
| 161 void RendererClipboardClient::ReadImage(ui::Clipboard::Buffer buffer, | 167 void RendererClipboardClient::ReadImage(ui::Clipboard::Buffer buffer, |
| 162 std::string* data) { | 168 std::string* data) { |
| 163 base::SharedMemoryHandle image_handle; | 169 base::SharedMemoryHandle image_handle; |
| 164 uint32 image_size; | 170 uint32 image_size; |
| 165 RenderThreadImpl::current()->Send( | 171 RenderThreadImpl::current()->Send( |
| 166 new ClipboardHostMsg_ReadImage(buffer, &image_handle, &image_size)); | 172 new ClipboardHostMsg_ReadImage(buffer, &image_handle, &image_size)); |
| 167 if (base::SharedMemory::IsHandleValid(image_handle)) { | 173 if (base::SharedMemory::IsHandleValid(image_handle)) { |
| 168 base::SharedMemory buffer(image_handle, true); | 174 base::SharedMemory buffer(image_handle, true); |
| 169 buffer.Map(image_size); | 175 buffer.Map(image_size); |
| 170 data->append(static_cast<char*>(buffer.memory()), image_size); | 176 data->append(static_cast<char*>(buffer.memory()), image_size); |
| 171 } | 177 } |
| 172 } | 178 } |
| 173 | 179 |
| 174 void RendererClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, | 180 void RendererClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, |
| 175 const string16& type, | 181 const string16& type, |
| 176 string16* data) { | 182 string16* data) { |
| 177 RenderThreadImpl::current()->Send( | 183 RenderThreadImpl::current()->Send( |
| 178 new ClipboardHostMsg_ReadCustomData(buffer, type, data)); | 184 new ClipboardHostMsg_ReadCustomData(buffer, type, data)); |
| 179 } | 185 } |
| 180 | 186 |
| 181 webkit_glue::ClipboardClient::WriteContext* | 187 webkit_glue::ClipboardClient::WriteContext* |
| 182 RendererClipboardClient::CreateWriteContext() { | 188 RendererClipboardClient::CreateWriteContext() { |
| 183 return new RendererClipboardWriteContext; | 189 return new RendererClipboardWriteContext; |
| 184 } | 190 } |
| OLD | NEW |