OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/clipboard.h" | 7 #include "base/clipboard.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/gfx/native_widget_types.h" | 9 #include "base/gfx/native_widget_types.h" |
10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 // with GTK on the UI thread, or with Xlib on the BACKGROUND_X11 thread. In an | 620 // with GTK on the UI thread, or with Xlib on the BACKGROUND_X11 thread. In an |
621 // ideal world, we would do the latter. However, for now we're going to | 621 // ideal world, we would do the latter. However, for now we're going to |
622 // terminate these calls on the UI thread. This risks deadlock in the case of | 622 // terminate these calls on the UI thread. This risks deadlock in the case of |
623 // plugins, but it's better than crashing which is what doing on the IO thread | 623 // plugins, but it's better than crashing which is what doing on the IO thread |
624 // gives us. | 624 // gives us. |
625 // | 625 // |
626 // See resource_message_filter_gtk.cc for the Linux implementation of these | 626 // See resource_message_filter_gtk.cc for the Linux implementation of these |
627 // functions. | 627 // functions. |
628 | 628 |
629 void ResourceMessageFilter::OnClipboardIsFormatAvailable( | 629 void ResourceMessageFilter::OnClipboardIsFormatAvailable( |
630 Clipboard::FormatType format, IPC::Message* reply) { | 630 Clipboard::FormatType format, Clipboard::Buffer buffer, |
631 const bool result = GetClipboard()->IsFormatAvailable(format); | 631 IPC::Message* reply) { |
| 632 const bool result = GetClipboard()->IsFormatAvailable(format, buffer); |
632 ViewHostMsg_ClipboardIsFormatAvailable::WriteReplyParams(reply, result); | 633 ViewHostMsg_ClipboardIsFormatAvailable::WriteReplyParams(reply, result); |
633 Send(reply); | 634 Send(reply); |
634 } | 635 } |
635 | 636 |
636 void ResourceMessageFilter::OnClipboardReadText(IPC::Message* reply) { | 637 void ResourceMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer, |
| 638 IPC::Message* reply) { |
637 string16 result; | 639 string16 result; |
638 GetClipboard()->ReadText(&result); | 640 GetClipboard()->ReadText(buffer, &result); |
639 ViewHostMsg_ClipboardReadText::WriteReplyParams(reply, result); | 641 ViewHostMsg_ClipboardReadText::WriteReplyParams(reply, result); |
640 Send(reply); | 642 Send(reply); |
641 } | 643 } |
642 | 644 |
643 void ResourceMessageFilter::OnClipboardReadAsciiText(IPC::Message* reply) { | 645 void ResourceMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer, |
| 646 IPC::Message* reply) { |
644 std::string result; | 647 std::string result; |
645 GetClipboard()->ReadAsciiText(&result); | 648 GetClipboard()->ReadAsciiText(buffer, &result); |
646 ViewHostMsg_ClipboardReadAsciiText::WriteReplyParams(reply, result); | 649 ViewHostMsg_ClipboardReadAsciiText::WriteReplyParams(reply, result); |
647 Send(reply); | 650 Send(reply); |
648 } | 651 } |
649 | 652 |
650 void ResourceMessageFilter::OnClipboardReadHTML(IPC::Message* reply) { | 653 void ResourceMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer, |
| 654 IPC::Message* reply) { |
651 std::string src_url_str; | 655 std::string src_url_str; |
652 string16 markup; | 656 string16 markup; |
653 GetClipboard()->ReadHTML(&markup, &src_url_str); | 657 GetClipboard()->ReadHTML(buffer, &markup, &src_url_str); |
654 const GURL src_url = GURL(src_url_str); | 658 const GURL src_url = GURL(src_url_str); |
655 | 659 |
656 ViewHostMsg_ClipboardReadHTML::WriteReplyParams(reply, markup, src_url); | 660 ViewHostMsg_ClipboardReadHTML::WriteReplyParams(reply, markup, src_url); |
657 Send(reply); | 661 Send(reply); |
658 } | 662 } |
659 | 663 |
660 #endif | 664 #endif |
661 | 665 |
662 void ResourceMessageFilter::OnGetMimeTypeFromExtension( | 666 void ResourceMessageFilter::OnGetMimeTypeFromExtension( |
663 const FilePath::StringType& ext, std::string* mime_type) { | 667 const FilePath::StringType& ext, std::string* mime_type) { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 } | 1009 } |
1006 | 1010 |
1007 void ResourceMessageFilter::ReplyGetFileSize(int64 result, void* param) { | 1011 void ResourceMessageFilter::ReplyGetFileSize(int64 result, void* param) { |
1008 IPC::Message* reply_msg = static_cast<IPC::Message*>(param); | 1012 IPC::Message* reply_msg = static_cast<IPC::Message*>(param); |
1009 ViewHostMsg_GetFileSize::WriteReplyParams(reply_msg, result); | 1013 ViewHostMsg_GetFileSize::WriteReplyParams(reply_msg, result); |
1010 Send(reply_msg); | 1014 Send(reply_msg); |
1011 | 1015 |
1012 // Getting file size callback done, decrease the ref count. | 1016 // Getting file size callback done, decrease the ref count. |
1013 Release(); | 1017 Release(); |
1014 } | 1018 } |
OLD | NEW |