| 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 the Clipboard interface. | 5 // This file provides the embedder's side of the Clipboard interface. |
| 6 | 6 |
| 7 #include "content/renderer/renderer_clipboard_client.h" | 7 #include "content/renderer/renderer_clipboard_client.h" |
| 8 | 8 |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return NULL; | 100 return NULL; |
| 101 } | 101 } |
| 102 | 102 |
| 103 uint64 RendererClipboardClient::GetSequenceNumber(ui::ClipboardType type) { | 103 uint64 RendererClipboardClient::GetSequenceNumber(ui::ClipboardType type) { |
| 104 uint64 sequence_number = 0; | 104 uint64 sequence_number = 0; |
| 105 RenderThreadImpl::current()->Send( | 105 RenderThreadImpl::current()->Send( |
| 106 new ClipboardHostMsg_GetSequenceNumber(type, &sequence_number)); | 106 new ClipboardHostMsg_GetSequenceNumber(type, &sequence_number)); |
| 107 return sequence_number; | 107 return sequence_number; |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool RendererClipboardClient::IsFormatAvailable( | 110 bool RendererClipboardClient::IsFormatAvailable(content::ClipboardFormat format, |
| 111 const ui::Clipboard::FormatType& format, | 111 ui::ClipboardType type) { |
| 112 ui::ClipboardType type) { | |
| 113 bool result; | 112 bool result; |
| 114 RenderThreadImpl::current()->Send( | 113 RenderThreadImpl::current()->Send( |
| 115 new ClipboardHostMsg_IsFormatAvailable(format, type, &result)); | 114 new ClipboardHostMsg_IsFormatAvailable(format, type, &result)); |
| 116 return result; | 115 return result; |
| 117 } | 116 } |
| 118 | 117 |
| 119 void RendererClipboardClient::Clear(ui::ClipboardType type) { | 118 void RendererClipboardClient::Clear(ui::ClipboardType type) { |
| 120 RenderThreadImpl::current()->Send(new ClipboardHostMsg_Clear(type)); | 119 RenderThreadImpl::current()->Send(new ClipboardHostMsg_Clear(type)); |
| 121 } | 120 } |
| 122 | 121 |
| 123 void RendererClipboardClient::ReadAvailableTypes( | 122 void RendererClipboardClient::ReadAvailableTypes( |
| 124 ui::ClipboardType type, | 123 ui::ClipboardType type, |
| 125 std::vector<base::string16>* types, | 124 std::vector<base::string16>* types, |
| 126 bool* contains_filenames) { | 125 bool* contains_filenames) { |
| 127 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadAvailableTypes( | 126 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadAvailableTypes( |
| 128 type, types, contains_filenames)); | 127 type, types, contains_filenames)); |
| 129 } | 128 } |
| 130 | 129 |
| 131 void RendererClipboardClient::ReadText(ui::ClipboardType type, | 130 void RendererClipboardClient::ReadText(ui::ClipboardType type, |
| 132 base::string16* result) { | 131 base::string16* result) { |
| 133 RenderThreadImpl::current()->Send( | 132 RenderThreadImpl::current()->Send( |
| 134 new ClipboardHostMsg_ReadText(type, result)); | 133 new ClipboardHostMsg_ReadText(type, result)); |
| 135 } | 134 } |
| 136 | 135 |
| 137 void RendererClipboardClient::ReadAsciiText(ui::ClipboardType type, | |
| 138 std::string* result) { | |
| 139 RenderThreadImpl::current()->Send( | |
| 140 new ClipboardHostMsg_ReadAsciiText(type, result)); | |
| 141 } | |
| 142 | |
| 143 void RendererClipboardClient::ReadHTML(ui::ClipboardType type, | 136 void RendererClipboardClient::ReadHTML(ui::ClipboardType type, |
| 144 base::string16* markup, | 137 base::string16* markup, |
| 145 GURL* url, uint32* fragment_start, | 138 GURL* url, uint32* fragment_start, |
| 146 uint32* fragment_end) { | 139 uint32* fragment_end) { |
| 147 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadHTML( | 140 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadHTML( |
| 148 type, markup, url, fragment_start, fragment_end)); | 141 type, markup, url, fragment_start, fragment_end)); |
| 149 } | 142 } |
| 150 | 143 |
| 151 void RendererClipboardClient::ReadRTF(ui::ClipboardType type, | 144 void RendererClipboardClient::ReadRTF(ui::ClipboardType type, |
| 152 std::string* result) { | 145 std::string* result) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 177 std::string* data) { | 170 std::string* data) { |
| 178 RenderThreadImpl::current()->Send( | 171 RenderThreadImpl::current()->Send( |
| 179 new ClipboardHostMsg_ReadData(format, data)); | 172 new ClipboardHostMsg_ReadData(format, data)); |
| 180 } | 173 } |
| 181 | 174 |
| 182 ClipboardClient::WriteContext* RendererClipboardClient::CreateWriteContext() { | 175 ClipboardClient::WriteContext* RendererClipboardClient::CreateWriteContext() { |
| 183 return new RendererClipboardWriteContext; | 176 return new RendererClipboardWriteContext; |
| 184 } | 177 } |
| 185 | 178 |
| 186 } // namespace content | 179 } // namespace content |
| OLD | NEW |