Index: content/browser/renderer_host/clipboard_message_filter_mac.mm |
diff --git a/content/browser/renderer_host/clipboard_message_filter_mac.mm b/content/browser/renderer_host/clipboard_message_filter_mac.mm |
index 81faeb10c5a65ce293eff11cb73c7cf0682107fb..168eb55f352d55e853a26a924cb577e988b575ce 100644 |
--- a/content/browser/renderer_host/clipboard_message_filter_mac.mm |
+++ b/content/browser/renderer_host/clipboard_message_filter_mac.mm |
@@ -6,20 +6,25 @@ |
#import <Cocoa/Cocoa.h> |
+#include "base/basictypes.h" |
+#include "base/bind.h" |
+#include "base/bind_helpers.h" |
#include "base/sys_string_conversions.h" |
#import "content/browser/find_pasteboard.h" |
#include "content/public/browser/browser_thread.h" |
using content::BrowserThread; |
+namespace { |
+ |
// The number of utf16 code units that will be written to the find pasteboard, |
// longer texts are silently ignored. This is to prevent that a compromised |
// renderer can write unlimited amounts of data into the find pasteboard. |
static const size_t kMaxFindPboardStringLength = 4096; |
-class WriteFindPboardTask : public Task { |
+class WriteFindPboardWrapper { |
public: |
- explicit WriteFindPboardTask(NSString* text) |
+ explicit WriteFindPboardWrapper(NSString* text) |
: text_([text retain]) {} |
void Run() { |
@@ -28,8 +33,12 @@ class WriteFindPboardTask : public Task { |
private: |
scoped_nsobject<NSString> text_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WriteFindPboardWrapper); |
}; |
+} // namespace |
+ |
// Called on the IO thread. |
void ClipboardMessageFilter::OnFindPboardWriteString(const string16& text) { |
if (text.length() <= kMaxFindPboardStringLength) { |
@@ -37,7 +46,9 @@ void ClipboardMessageFilter::OnFindPboardWriteString(const string16& text) { |
if (nsText) { |
// FindPasteboard must be used on the UI thread. |
BrowserThread::PostTask( |
- BrowserThread::UI, FROM_HERE, new WriteFindPboardTask(nsText)); |
+ BrowserThread::UI, FROM_HERE, base::Bind( |
+ &WriteFindPboardWrapper::Run, |
+ base::Owned(new WriteFindPboardWrapper(nsText)))); |
} |
} |
} |