| Index: chrome/browser/renderer_host/resource_message_filter_mac.mm
|
| diff --git a/chrome/browser/renderer_host/resource_message_filter_mac.mm b/chrome/browser/renderer_host/resource_message_filter_mac.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b63c5bff4ea6cc657d528b627c7353783be891c0
|
| --- /dev/null
|
| +++ b/chrome/browser/renderer_host/resource_message_filter_mac.mm
|
| @@ -0,0 +1,28 @@
|
| +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/renderer_host/resource_message_filter.h"
|
| +
|
| +#import <Cocoa/Cocoa.h>
|
| +
|
| +#include "base/sys_string_conversions.h"
|
| +
|
| +// 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;
|
| +
|
| +// Called on the IO thread.
|
| +void ResourceMessageFilter::OnClipboardFindPboardWriteString(
|
| + const string16& text) {
|
| + if (text.length() <= kMaxFindPboardStringLength) {
|
| + NSString* nsText = base::SysUTF16ToNSString(text);
|
| + if (nsText) {
|
| + NSPasteboard* findPboard = [NSPasteboard pasteboardWithName:NSFindPboard];
|
| + [findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType]
|
| + owner:nil];
|
| + [findPboard setString:nsText forType:NSStringPboardType];
|
| + }
|
| + }
|
| +}
|
|
|