Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: content/browser/renderer_host/clipboard_message_filter_mac.mm

Issue 8638004: Revert 111083 - Revert 111080 - Remove Task inheritance in clipboard code." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/clipboard_message_filter.cc ('k') | ui/base/clipboard/clipboard.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))));
}
}
}
« no previous file with comments | « content/browser/renderer_host/clipboard_message_filter.cc ('k') | ui/base/clipboard/clipboard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698