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

Side by Side Diff: chrome/browser/cocoa/autocomplete_text_field_editor.mm

Issue 159018: [Mac] Strip newlines from paste. (Closed)
Patch Set: Test empty clipboard Created 11 years, 5 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" 5 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 9
10 @implementation AutocompleteTextFieldEditor 10 @implementation AutocompleteTextFieldEditor
(...skipping 12 matching lines...) Expand all
23 [pb declareTypes:[NSArray array] owner:nil]; 23 [pb declareTypes:[NSArray array] owner:nil];
24 [self writeSelectionToPasteboard:pb types: 24 [self writeSelectionToPasteboard:pb types:
25 [NSArray arrayWithObject:NSStringPboardType]]; 25 [NSArray arrayWithObject:NSStringPboardType]];
26 } 26 }
27 27
28 - (void)performCut:(NSPasteboard*)pb { 28 - (void)performCut:(NSPasteboard*)pb {
29 [self performCopy:pb]; 29 [self performCopy:pb];
30 [self delete:nil]; 30 [self delete:nil];
31 } 31 }
32 32
33 - (BOOL)shouldPaste {
34 id delegate = [self delegate];
35 if (![delegate respondsToSelector:@selector(textShouldPaste:)] ||
36 [delegate textShouldPaste:self]) {
37 return YES;
38 }
39 return NO;
40 }
41
42 - (void)paste:(id)sender {
43 if ([self shouldPaste]) {
44 [super paste:sender];
45 }
46 }
47
33 @end 48 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_editor.h ('k') | chrome/browser/cocoa/autocomplete_text_field_editor_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698