| OLD | NEW |
| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 // AutocompleteTextFieldEditor customized the AutocompletTextField | 7 // AutocompleteTextFieldEditor customized the AutocompletTextField |
| 8 // field editor (helper text-view used in editing). It intercepts UI | 8 // field editor (helper text-view used in editing). It intercepts UI |
| 9 // events for forwarding to the core Omnibox code. It also undoes | 9 // events for forwarding to the core Omnibox code. It also undoes |
| 10 // some of the effects of using styled text in the Omnibox (the text | 10 // some of the effects of using styled text in the Omnibox (the text |
| 11 // is styled but should not appear that way when copied to the | 11 // is styled but should not appear that way when copied to the |
| 12 // pasteboard). | 12 // pasteboard). |
| 13 | 13 |
| 14 // AutocompleteTextFieldEditorDelegateMethods are meant to be similar | 14 // AutocompleteTextFieldEditorDelegateMethods are meant to be similar |
| 15 // to NSTextView delegate methods, adding additional intercepts | 15 // to NSTextView delegate methods, adding additional intercepts |
| 16 // relevant to the Omnibox implementation. | 16 // relevant to the Omnibox implementation. |
| 17 | 17 |
| 18 @protocol AutocompleteTextFieldEditorDelegateMethods | 18 @protocol AutocompleteTextFieldEditorDelegateMethods |
| 19 | 19 |
| 20 // Delegate -paste: implementation to the field being edited. If the | 20 // Delegate -paste: implementation to the field being edited. If the |
| 21 // delegate returns YES, or does not implement the method, NSTextView | 21 // delegate returns YES, or does not implement the method, NSTextView |
| 22 // is called to handle the paste. The delegate can block the paste | 22 // is called to handle the paste. The delegate can block the paste |
| 23 // (or handle it internally) by returning NO. | 23 // (or handle it internally) by returning NO. |
| 24 - (BOOL)textShouldPaste:(NSText*)fieldEditor; | 24 - (BOOL)textShouldPaste:(NSText*)fieldEditor; |
| 25 | 25 |
| 26 // Returns nil if paste actions are not supported. |
| 27 - (NSString*)textPasteActionString:(NSText*)fieldEditor; |
| 28 - (void)textDidPasteAndGo:(NSText*)fieldEditor; |
| 26 @end | 29 @end |
| 27 | 30 |
| 28 // Field editor used for the autocomplete field. | 31 // Field editor used for the autocomplete field. |
| 29 @interface AutocompleteTextFieldEditor : NSTextView { | 32 @interface AutocompleteTextFieldEditor : NSTextView { |
| 30 } | 33 } |
| 31 | 34 |
| 32 // Copy contents of the TextView to the designated clipboard as plain | 35 // Copy contents of the TextView to the designated clipboard as plain |
| 33 // text. | 36 // text. |
| 34 - (void)performCopy:(NSPasteboard*)pb; | 37 - (void)performCopy:(NSPasteboard*)pb; |
| 35 | 38 |
| 36 // Same as above, note that this calls through to performCopy. | 39 // Same as above, note that this calls through to performCopy. |
| 37 - (void)performCut:(NSPasteboard*)pb; | 40 - (void)performCut:(NSPasteboard*)pb; |
| 38 | 41 |
| 39 // Called by -paste: to decide whether to forward to superclass. | 42 // Called by -paste: to decide whether to forward to superclass. |
| 40 // Exposed for unit testing. | 43 // Exposed for unit testing. |
| 41 - (BOOL)shouldPaste; | 44 - (BOOL)shouldPaste; |
| 42 | 45 |
| 43 @end | 46 @end |
| OLD | NEW |