| 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 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (IPC_MESSAGE_CLASS(message) == ClipboardMsgStart) | 70 if (IPC_MESSAGE_CLASS(message) == ClipboardMsgStart) |
| 71 *thread = BrowserThread::UI; | 71 *thread = BrowserThread::UI; |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
| 75 if (message.type() == ClipboardHostMsg_ReadImage::ID) | 75 if (message.type() == ClipboardHostMsg_ReadImage::ID) |
| 76 *thread = BrowserThread::FILE; | 76 *thread = BrowserThread::FILE; |
| 77 #endif | 77 #endif |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool ClipboardMessageFilter::OnMessageReceived(const IPC::Message& message, | 80 bool ClipboardMessageFilter::OnMessageReceived(const IPC::Message& message) { |
| 81 bool* message_was_ok) { | |
| 82 bool handled = true; | 81 bool handled = true; |
| 83 IPC_BEGIN_MESSAGE_MAP_EX(ClipboardMessageFilter, message, *message_was_ok) | 82 IPC_BEGIN_MESSAGE_MAP(ClipboardMessageFilter, message) |
| 84 IPC_MESSAGE_HANDLER(ClipboardHostMsg_WriteObjectsAsync, OnWriteObjectsAsync) | 83 IPC_MESSAGE_HANDLER(ClipboardHostMsg_WriteObjectsAsync, OnWriteObjectsAsync) |
| 85 IPC_MESSAGE_HANDLER(ClipboardHostMsg_WriteObjectsSync, OnWriteObjectsSync) | 84 IPC_MESSAGE_HANDLER(ClipboardHostMsg_WriteObjectsSync, OnWriteObjectsSync) |
| 86 IPC_MESSAGE_HANDLER(ClipboardHostMsg_GetSequenceNumber, OnGetSequenceNumber) | 85 IPC_MESSAGE_HANDLER(ClipboardHostMsg_GetSequenceNumber, OnGetSequenceNumber) |
| 87 IPC_MESSAGE_HANDLER(ClipboardHostMsg_IsFormatAvailable, OnIsFormatAvailable) | 86 IPC_MESSAGE_HANDLER(ClipboardHostMsg_IsFormatAvailable, OnIsFormatAvailable) |
| 88 IPC_MESSAGE_HANDLER(ClipboardHostMsg_Clear, OnClear) | 87 IPC_MESSAGE_HANDLER(ClipboardHostMsg_Clear, OnClear) |
| 89 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadAvailableTypes, | 88 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadAvailableTypes, |
| 90 OnReadAvailableTypes) | 89 OnReadAvailableTypes) |
| 91 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadText, OnReadText) | 90 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadText, OnReadText) |
| 92 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadHTML, OnReadHTML) | 91 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadHTML, OnReadHTML) |
| 93 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadRTF, OnReadRTF) | 92 IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadRTF, OnReadRTF) |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 288 |
| 290 // static | 289 // static |
| 291 ui::Clipboard* ClipboardMessageFilter::GetClipboard() { | 290 ui::Clipboard* ClipboardMessageFilter::GetClipboard() { |
| 292 // We have a static instance of the clipboard service for use by all message | 291 // We have a static instance of the clipboard service for use by all message |
| 293 // filters. This instance lives for the life of the browser processes. | 292 // filters. This instance lives for the life of the browser processes. |
| 294 static ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); | 293 static ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); |
| 295 return clipboard; | 294 return clipboard; |
| 296 } | 295 } |
| 297 | 296 |
| 298 } // namespace content | 297 } // namespace content |
| OLD | NEW |