| Index: content/browser/renderer_host/clipboard_message_filter.cc
|
| ===================================================================
|
| --- content/browser/renderer_host/clipboard_message_filter.cc (revision 111082)
|
| +++ content/browser/renderer_host/clipboard_message_filter.cc (working copy)
|
| @@ -11,7 +11,6 @@
|
| #endif
|
|
|
| #include "base/bind.h"
|
| -#include "base/bind_helpers.h"
|
| #include "base/stl_util.h"
|
| #include "content/common/clipboard_messages.h"
|
| #include "content/public/browser/content_browser_client.h"
|
| @@ -25,13 +24,25 @@
|
|
|
| namespace {
|
|
|
| -// This helper is needed because content::ContentBrowserClient::GetClipboard()
|
| -// must be called on the UI thread.
|
| -void WriteObjectsHelper(const ui::Clipboard::ObjectMap* objects) {
|
| - content::GetContentClient()->browser()->GetClipboard()->WriteObjects(
|
| - *objects);
|
| -}
|
| +// Completes a clipboard write initiated by the renderer. The write must be
|
| +// performed on the UI thread because the clipboard service from the IO thread
|
| +// cannot create windows so it cannot be the "owner" of the clipboard's
|
| +// contents.
|
| +class WriteClipboardTask : public Task {
|
| + public:
|
| + explicit WriteClipboardTask(ui::Clipboard::ObjectMap* objects)
|
| + : objects_(objects) {}
|
| + ~WriteClipboardTask() {}
|
|
|
| + void Run() {
|
| + content::GetContentClient()->browser()->GetClipboard()->WriteObjects(
|
| + *objects_.get());
|
| + }
|
| +
|
| + private:
|
| + scoped_ptr<ui::Clipboard::ObjectMap> objects_;
|
| +};
|
| +
|
| } // namespace
|
|
|
| ClipboardMessageFilter::ClipboardMessageFilter() {
|
| @@ -93,7 +104,7 @@
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| - base::Bind(&WriteObjectsHelper, base::Owned(long_living_objects)));
|
| + new WriteClipboardTask(long_living_objects));
|
| }
|
|
|
| void ClipboardMessageFilter::OnWriteObjectsAsync(
|
| @@ -111,7 +122,7 @@
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| - base::Bind(&WriteObjectsHelper, base::Owned(long_living_objects)));
|
| + new WriteClipboardTask(long_living_objects));
|
| }
|
|
|
| void ClipboardMessageFilter::OnGetSequenceNumber(
|
|
|