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