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 #include "content/browser/renderer_host/clipboard_message_filter.h" | 5 #include "content/browser/renderer_host/clipboard_message_filter.h" |
6 | 6 |
7 #if defined(USE_SYSTEM_ZLIB) | 7 #if defined(USE_SYSTEM_ZLIB) |
8 #include <zlib.h> | 8 #include <zlib.h> |
9 #else | 9 #else |
10 #include "third_party/zlib/zlib.h" | 10 #include "third_party/zlib/zlib.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 IPC_MESSAGE_HANDLER(ClipboardHostMsg_IsFormatAvailable, OnIsFormatAvailable) | 74 IPC_MESSAGE_HANDLER(ClipboardHostMsg_IsFormatAvailable, OnIsFormatAvailable) |
75 IPC_MESSAGE_HANDLER(ClipboardHostMsg_Clear, OnClear) | 75 IPC_MESSAGE_HANDLER(ClipboardHostMsg_Clear, OnClear) |
76 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadAvailableTypes, | 76 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadAvailableTypes, |
77 OnReadAvailableTypes) | 77 OnReadAvailableTypes) |
78 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadText, OnReadText) | 78 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadText, OnReadText) |
79 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadAsciiText, OnReadAsciiText) | 79 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadAsciiText, OnReadAsciiText) |
80 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadHTML, OnReadHTML) | 80 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadHTML, OnReadHTML) |
81 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadRTF, OnReadRTF) | 81 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadRTF, OnReadRTF) |
82 IPC_MESSAGE_HANDLER_DELAY_REPLY(ClipboardHostMsg_ReadImage, OnReadImage) | 82 IPC_MESSAGE_HANDLER_DELAY_REPLY(ClipboardHostMsg_ReadImage, OnReadImage) |
83 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadCustomData, OnReadCustomData) | 83 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadCustomData, OnReadCustomData) |
| 84 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadData, OnReadData) |
84 #if defined(OS_MACOSX) | 85 #if defined(OS_MACOSX) |
85 IPC_MESSAGE_HANDLER(ClipboardHostMsg_FindPboardWriteStringAsync, | 86 IPC_MESSAGE_HANDLER(ClipboardHostMsg_FindPboardWriteStringAsync, |
86 OnFindPboardWriteString) | 87 OnFindPboardWriteString) |
87 #endif | 88 #endif |
88 IPC_MESSAGE_UNHANDLED(handled = false) | 89 IPC_MESSAGE_UNHANDLED(handled = false) |
89 IPC_END_MESSAGE_MAP() | 90 IPC_END_MESSAGE_MAP() |
90 return handled; | 91 return handled; |
91 } | 92 } |
92 | 93 |
93 ClipboardMessageFilter::~ClipboardMessageFilter() { | 94 ClipboardMessageFilter::~ClipboardMessageFilter() { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 ClipboardHostMsg_ReadImage::WriteReplyParams(reply_msg, image_handle, | 234 ClipboardHostMsg_ReadImage::WriteReplyParams(reply_msg, image_handle, |
234 image_size); | 235 image_size); |
235 Send(reply_msg); | 236 Send(reply_msg); |
236 } | 237 } |
237 | 238 |
238 void ClipboardMessageFilter::OnReadCustomData( | 239 void ClipboardMessageFilter::OnReadCustomData( |
239 ui::Clipboard::Buffer buffer, const string16& type, string16* result) { | 240 ui::Clipboard::Buffer buffer, const string16& type, string16* result) { |
240 GetClipboard()->ReadCustomData(buffer, type, result); | 241 GetClipboard()->ReadCustomData(buffer, type, result); |
241 } | 242 } |
242 | 243 |
| 244 void ClipboardMessageFilter::OnReadData(const ui::Clipboard::FormatType& format, |
| 245 std::string* data) { |
| 246 GetClipboard()->ReadData(format, data); |
| 247 } |
| 248 |
243 // static | 249 // static |
244 ui::Clipboard* ClipboardMessageFilter::GetClipboard() { | 250 ui::Clipboard* ClipboardMessageFilter::GetClipboard() { |
245 // We have a static instance of the clipboard service for use by all message | 251 // We have a static instance of the clipboard service for use by all message |
246 // filters. This instance lives for the life of the browser processes. | 252 // filters. This instance lives for the life of the browser processes. |
247 static ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); | 253 static ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); |
248 return clipboard; | 254 return clipboard; |
249 } | 255 } |
250 | 256 |
251 } // namespace content | 257 } // namespace content |
OLD | NEW |