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 "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_fil
ter.h" | 5 #include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_fil
ter.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 OnMsgRegisterCustomFormat); | 130 OnMsgRegisterCustomFormat); |
131 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 131 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
132 PpapiHostMsg_FlashClipboard_IsFormatAvailable, | 132 PpapiHostMsg_FlashClipboard_IsFormatAvailable, |
133 OnMsgIsFormatAvailable); | 133 OnMsgIsFormatAvailable); |
134 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 134 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
135 PpapiHostMsg_FlashClipboard_ReadData, | 135 PpapiHostMsg_FlashClipboard_ReadData, |
136 OnMsgReadData); | 136 OnMsgReadData); |
137 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 137 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
138 PpapiHostMsg_FlashClipboard_WriteData, | 138 PpapiHostMsg_FlashClipboard_WriteData, |
139 OnMsgWriteData); | 139 OnMsgWriteData); |
| 140 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
| 141 PpapiHostMsg_FlashClipboard_GetSequenceNumber, |
| 142 OnMsgGetSequenceNumber); |
140 IPC_END_MESSAGE_MAP() | 143 IPC_END_MESSAGE_MAP() |
141 return PP_ERROR_FAILED; | 144 return PP_ERROR_FAILED; |
142 } | 145 } |
143 | 146 |
144 int32_t PepperFlashClipboardMessageFilter::OnMsgRegisterCustomFormat( | 147 int32_t PepperFlashClipboardMessageFilter::OnMsgRegisterCustomFormat( |
145 ppapi::host::HostMessageContext* host_context, | 148 ppapi::host::HostMessageContext* host_context, |
146 const std::string& format_name) { | 149 const std::string& format_name) { |
147 uint32_t format = custom_formats_.RegisterFormat(format_name); | 150 uint32_t format = custom_formats_.RegisterFormat(format_name); |
148 if (format == PP_FLASH_CLIPBOARD_FORMAT_INVALID) | 151 if (format == PP_FLASH_CLIPBOARD_FORMAT_INVALID) |
149 return PP_ERROR_FAILED; | 152 return PP_ERROR_FAILED; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 355 } |
353 | 356 |
354 if (res != PP_OK) { | 357 if (res != PP_OK) { |
355 // Need to clear the objects so nothing is written. | 358 // Need to clear the objects so nothing is written. |
356 scw.Reset(); | 359 scw.Reset(); |
357 } | 360 } |
358 | 361 |
359 return res; | 362 return res; |
360 } | 363 } |
361 | 364 |
| 365 int32_t PepperFlashClipboardMessageFilter::OnMsgGetSequenceNumber( |
| 366 ppapi::host::HostMessageContext* host_context, |
| 367 uint32_t clipboard_type) { |
| 368 if (clipboard_type != PP_FLASH_CLIPBOARD_TYPE_STANDARD) { |
| 369 NOTIMPLEMENTED(); |
| 370 return PP_ERROR_FAILED; |
| 371 } |
| 372 |
| 373 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); |
| 374 ui::ClipboardType type = ConvertClipboardType(clipboard_type); |
| 375 int64_t sequence_number = clipboard->GetSequenceNumber(type); |
| 376 host_context->reply_msg = |
| 377 PpapiPluginMsg_FlashClipboard_GetSequenceNumberReply(sequence_number); |
| 378 return PP_OK; |
| 379 } |
| 380 |
362 } // namespace chrome | 381 } // namespace chrome |
OLD | NEW |