| Index: content/browser/renderer_host/clipboard_message_filter_mac.mm
|
| ===================================================================
|
| --- content/browser/renderer_host/clipboard_message_filter_mac.mm (revision 111082)
|
| +++ content/browser/renderer_host/clipboard_message_filter_mac.mm (working copy)
|
| @@ -6,25 +6,20 @@
|
|
|
| #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 WriteFindPboardWrapper {
|
| +class WriteFindPboardTask : public Task {
|
| public:
|
| - explicit WriteFindPboardWrapper(NSString* text)
|
| + explicit WriteFindPboardTask(NSString* text)
|
| : text_([text retain]) {}
|
|
|
| void Run() {
|
| @@ -33,12 +28,8 @@
|
|
|
| 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) {
|
| @@ -46,9 +37,7 @@
|
| if (nsText) {
|
| // FindPasteboard must be used on the UI thread.
|
| BrowserThread::PostTask(
|
| - BrowserThread::UI, FROM_HERE, base::Bind(
|
| - &WriteFindPboardWrapper::Run,
|
| - base::Owned(new WriteFindPboardWrapper(nsText))));
|
| + BrowserThread::UI, FROM_HERE, new WriteFindPboardTask(nsText));
|
| }
|
| }
|
| }
|
|
|