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