| Index: chrome/browser/renderer_host/resource_message_filter_gtk.cc
|
| diff --git a/chrome/browser/renderer_host/resource_message_filter_gtk.cc b/chrome/browser/renderer_host/resource_message_filter_gtk.cc
|
| index 86c6f14eb3257be663f443bda59dc054ef35c3f6..dc00486cbb1661d2d6fa2b30043a43fcfcb650f5 100644
|
| --- a/chrome/browser/renderer_host/resource_message_filter_gtk.cc
|
| +++ b/chrome/browser/renderer_host/resource_message_filter_gtk.cc
|
| @@ -4,8 +4,10 @@
|
|
|
| #include "chrome/browser/renderer_host/resource_message_filter.h"
|
|
|
| +#include "base/clipboard.h"
|
| #include "base/gfx/gtk_native_view_id_manager.h"
|
| #include "chrome/browser/chrome_thread.h"
|
| +#include "chrome/common/clipboard_service.h"
|
| #include "chrome/common/render_messages.h"
|
| #include "chrome/common/x11_util.h"
|
|
|
| @@ -19,7 +21,7 @@ using WebKit::WebScreenInfoFactory;
|
| // http://crbug.com/9060 for more details.
|
|
|
| // Called on the IO thread.
|
| -void ResourceMessageFilter::SendBackgroundX11Reply(IPC::Message* reply_msg) {
|
| +void ResourceMessageFilter::SendDelayedReply(IPC::Message* reply_msg) {
|
| Send(reply_msg);
|
| }
|
|
|
| @@ -33,7 +35,7 @@ void ResourceMessageFilter::DoOnGetScreenInfo(gfx::NativeViewId view,
|
|
|
| ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
|
| FROM_HERE, NewRunnableMethod(
|
| - this, &ResourceMessageFilter::SendBackgroundX11Reply, reply_msg));
|
| + this, &ResourceMessageFilter::SendDelayedReply, reply_msg));
|
| }
|
|
|
| // Called on the BACKGROUND_X11 thread.
|
| @@ -57,7 +59,7 @@ void ResourceMessageFilter::DoOnGetWindowRect(gfx::NativeViewId view,
|
|
|
| ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
|
| FROM_HERE, NewRunnableMethod(
|
| - this, &ResourceMessageFilter::SendBackgroundX11Reply, reply_msg));
|
| + this, &ResourceMessageFilter::SendDelayedReply, reply_msg));
|
| }
|
|
|
| // Return the top-level parent of the given window. Called on the
|
| @@ -96,7 +98,58 @@ void ResourceMessageFilter::DoOnGetRootWindowRect(gfx::NativeViewId view,
|
|
|
| ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
|
| FROM_HERE, NewRunnableMethod(
|
| - this, &ResourceMessageFilter::SendBackgroundX11Reply, reply_msg));
|
| + this, &ResourceMessageFilter::SendDelayedReply, reply_msg));
|
| +}
|
| +
|
| +// Called on the UI thread.
|
| +void ResourceMessageFilter::DoOnClipboardIsFormatAvailable(
|
| + Clipboard::FormatType format, IPC::Message* reply_msg) {
|
| + const bool result = GetClipboardService()->IsFormatAvailable(format);
|
| +
|
| + ViewHostMsg_ClipboardIsFormatAvailable::WriteReplyParams(reply_msg, result);
|
| +
|
| + ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
|
| + FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::SendDelayedReply, reply_msg));
|
| +}
|
| +
|
| +// Called on the UI thread.
|
| +void ResourceMessageFilter::DoOnClipboardReadText(IPC::Message* reply_msg) {
|
| + string16 result;
|
| + GetClipboardService()->ReadText(&result);
|
| +
|
| + ViewHostMsg_ClipboardReadText::WriteReplyParams(reply_msg, result);
|
| +
|
| + ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
|
| + FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::SendDelayedReply, reply_msg));
|
| +}
|
| +
|
| +// Called on the UI thread.
|
| +void ResourceMessageFilter::DoOnClipboardReadAsciiText(
|
| + IPC::Message* reply_msg) {
|
| + std::string result;
|
| + GetClipboardService()->ReadAsciiText(&result);
|
| +
|
| + ViewHostMsg_ClipboardReadAsciiText::WriteReplyParams(reply_msg, result);
|
| +
|
| + ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
|
| + FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::SendDelayedReply, reply_msg));
|
| +}
|
| +
|
| +// Called on the UI thread.
|
| +void ResourceMessageFilter::DoOnClipboardReadHTML(IPC::Message* reply_msg) {
|
| + std::string src_url_str;
|
| + string16 markup;
|
| + GetClipboardService()->ReadHTML(&markup, &src_url_str);
|
| + const GURL src_url = GURL(src_url_str);
|
| +
|
| + ViewHostMsg_ClipboardReadHTML::WriteReplyParams(reply_msg, markup, src_url);
|
| +
|
| + ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
|
| + FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::SendDelayedReply, reply_msg));
|
| }
|
|
|
| // Called on the IO thread.
|
| @@ -122,3 +175,29 @@ void ResourceMessageFilter::OnGetRootWindowRect(gfx::NativeViewId view,
|
| FROM_HERE, NewRunnableMethod(
|
| this, &ResourceMessageFilter::DoOnGetRootWindowRect, view, reply_msg));
|
| }
|
| +
|
| +// Called on the IO thread.
|
| +void ResourceMessageFilter::OnClipboardIsFormatAvailable(
|
| + Clipboard::FormatType format, IPC::Message* reply_msg) {
|
| + ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::DoOnClipboardIsFormatAvailable, format,
|
| + reply_msg));
|
| +}
|
| +
|
| +// Called on the IO thread.
|
| +void ResourceMessageFilter::OnClipboardReadText(IPC::Message* reply_msg) {
|
| + ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::DoOnClipboardReadText, reply_msg));
|
| +}
|
| +
|
| +// Called on the IO thread.
|
| +void ResourceMessageFilter::OnClipboardReadAsciiText(IPC::Message* reply_msg) {
|
| + ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::DoOnClipboardReadAsciiText, reply_msg));
|
| +}
|
| +
|
| +// Called on the IO thread.
|
| +void ResourceMessageFilter::OnClipboardReadHTML(IPC::Message* reply_msg) {
|
| + ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
| + this, &ResourceMessageFilter::DoOnClipboardReadHTML, reply_msg));
|
| +}
|
|
|