Chromium Code Reviews| Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| index 2d0c43d99f670be3c63eb6511f370ec3153e33cd..464410f9d7a0f9615df2e81e24e889d71bd3e102 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| @@ -12,6 +12,7 @@ |
| #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| +#import "content/browser/find_pasteboard.h" |
| #include "grit/generated_resources.h" |
| #include "ui/base/l10n/l10n_util_mac.h" |
| @@ -472,4 +473,23 @@ BOOL ThePasteboardIsTooDamnBig() { |
| [super mouseDown:theEvent]; |
| } |
| +- (BOOL)validateMenuItem:(NSMenuItem*)item { |
| + if ([item action] == @selector(copyToFindPboard:)) |
| + return [self selectedRange].length > 0; |
| + return YES; |
|
Avi (use Gerrit)
2011/09/24 11:45:04
return [super validateMenuItem:item]? Otherwise co
|
| +} |
| + |
| +- (void)copyToFindPboard:(id)sender { |
| + NSRange selectedRange = [self selectedRange]; |
| + if (selectedRange.length == 0) |
| + return; |
| + NSAttributedString* selection = |
| + [self attributedSubstringForProposedRange:selectedRange |
| + actualRange:NULL]; |
| + if (!selection) |
| + return; |
| + |
| + [[FindPasteboard sharedInstance] setFindText:[selection string]]; |
|
Scott Hess - ex-Googler
2011/09/24 15:37:27
There are times I find myself not entirely convinc
|
| +} |
| + |
| @end |