OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/resource_message_filter.h" | 5 #include "chrome/browser/renderer_host/resource_message_filter.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "app/clipboard/clipboard.h" | 10 #include "app/clipboard/clipboard.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 ChromeThread::BACKGROUND_X11, FROM_HERE, | 241 ChromeThread::BACKGROUND_X11, FROM_HERE, |
242 NewRunnableMethod( | 242 NewRunnableMethod( |
243 this, &ResourceMessageFilter::DoOnGetRootWindowRect, view, | 243 this, &ResourceMessageFilter::DoOnGetRootWindowRect, view, |
244 reply_msg)); | 244 reply_msg)); |
245 } | 245 } |
246 | 246 |
247 // Called on the IO thread. | 247 // Called on the IO thread. |
248 void ResourceMessageFilter::OnClipboardIsFormatAvailable( | 248 void ResourceMessageFilter::OnClipboardIsFormatAvailable( |
249 Clipboard::FormatType format, Clipboard::Buffer buffer, | 249 Clipboard::FormatType format, Clipboard::Buffer buffer, |
250 IPC::Message* reply_msg) { | 250 IPC::Message* reply_msg) { |
251 ui_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 251 ChromeThread::PostTask( |
252 this, &ResourceMessageFilter::DoOnClipboardIsFormatAvailable, format, | 252 ChromeThread::UI, FROM_HERE, |
253 buffer, reply_msg)); | 253 NewRunnableMethod( |
| 254 this, &ResourceMessageFilter::DoOnClipboardIsFormatAvailable, format, |
| 255 buffer, reply_msg)); |
254 } | 256 } |
255 | 257 |
256 // Called on the IO thread. | 258 // Called on the IO thread. |
257 void ResourceMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer, | 259 void ResourceMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer, |
258 IPC::Message* reply_msg) { | 260 IPC::Message* reply_msg) { |
259 ui_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 261 ChromeThread::PostTask( |
260 this, &ResourceMessageFilter::DoOnClipboardReadText, buffer, | 262 ChromeThread::UI, FROM_HERE, |
261 reply_msg)); | 263 NewRunnableMethod( |
| 264 this, &ResourceMessageFilter::DoOnClipboardReadText, buffer, |
| 265 reply_msg)); |
262 } | 266 } |
263 | 267 |
264 // Called on the IO thread. | 268 // Called on the IO thread. |
265 void ResourceMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer, | 269 void ResourceMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer, |
266 IPC::Message* reply_msg) { | 270 IPC::Message* reply_msg) { |
267 ui_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 271 ChromeThread::PostTask( |
268 this, &ResourceMessageFilter::DoOnClipboardReadAsciiText, buffer, | 272 ChromeThread::UI, FROM_HERE, |
269 reply_msg)); | 273 NewRunnableMethod( |
| 274 this, &ResourceMessageFilter::DoOnClipboardReadAsciiText, buffer, |
| 275 reply_msg)); |
270 } | 276 } |
271 | 277 |
272 // Called on the IO thread. | 278 // Called on the IO thread. |
273 void ResourceMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer, | 279 void ResourceMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer, |
274 IPC::Message* reply_msg) { | 280 IPC::Message* reply_msg) { |
275 ui_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 281 ChromeThread::PostTask( |
276 this, &ResourceMessageFilter::DoOnClipboardReadHTML, buffer, | 282 ChromeThread::UI, FROM_HERE, |
277 reply_msg)); | 283 NewRunnableMethod( |
| 284 this, &ResourceMessageFilter::DoOnClipboardReadHTML, buffer, |
| 285 reply_msg)); |
278 } | 286 } |
279 | 287 |
280 // Called on the IO thread. | 288 // Called on the IO thread. |
281 void ResourceMessageFilter::OnAllocateTempFileForPrinting( | 289 void ResourceMessageFilter::OnAllocateTempFileForPrinting( |
282 IPC::Message* reply_msg) { | 290 IPC::Message* reply_msg) { |
283 ChromeThread::PostTask( | 291 ChromeThread::PostTask( |
284 ChromeThread::FILE, FROM_HERE, | 292 ChromeThread::FILE, FROM_HERE, |
285 NewRunnableMethod( | 293 NewRunnableMethod( |
286 this, &ResourceMessageFilter::DoOnAllocateTempFileForPrinting, | 294 this, &ResourceMessageFilter::DoOnAllocateTempFileForPrinting, |
287 reply_msg)); | 295 reply_msg)); |
288 } | 296 } |
289 | 297 |
290 // Called on the IO thread. | 298 // Called on the IO thread. |
291 void ResourceMessageFilter::OnTempFileForPrintingWritten(int fd_in_browser) { | 299 void ResourceMessageFilter::OnTempFileForPrintingWritten(int fd_in_browser) { |
292 FdMap* map = &Singleton<PrintingFileDescriptorMap>::get()->map; | 300 FdMap* map = &Singleton<PrintingFileDescriptorMap>::get()->map; |
293 FdMap::iterator it = map->find(fd_in_browser); | 301 FdMap::iterator it = map->find(fd_in_browser); |
294 if (it == map->end()) { | 302 if (it == map->end()) { |
295 NOTREACHED() << "Got a file descriptor that we didn't pass to the " | 303 NOTREACHED() << "Got a file descriptor that we didn't pass to the " |
296 "renderer: " << fd_in_browser; | 304 "renderer: " << fd_in_browser; |
297 return; | 305 return; |
298 } | 306 } |
299 | 307 |
300 #if defined(TOOLKIT_GTK) | 308 #if defined(TOOLKIT_GTK) |
301 PrintDialogGtk::CreatePrintDialogForPdf(it->second, ui_loop()); | 309 PrintDialogGtk::CreatePrintDialogForPdf(it->second); |
302 #else | 310 #else |
303 NOTIMPLEMENTED(); | 311 NOTIMPLEMENTED(); |
304 #endif | 312 #endif |
305 | 313 |
306 // Erase the entry in the map. | 314 // Erase the entry in the map. |
307 map->erase(it); | 315 map->erase(it); |
308 } | 316 } |
OLD | NEW |