| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 8 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 9 | 9 |
| 10 @class AutocompleteTextField; | 10 @class AutocompleteTextField; |
| 11 class AutocompleteTextFieldObserver; | 11 class AutocompleteTextFieldObserver; |
| 12 | 12 |
| 13 // AutocompleteTextFieldEditor customized the AutocompletTextField | 13 // AutocompleteTextFieldEditor customized the AutocompletTextField |
| 14 // field editor (helper text-view used in editing). It intercepts UI | 14 // field editor (helper text-view used in editing). It intercepts UI |
| 15 // events for forwarding to the core Omnibox code. It also undoes | 15 // events for forwarding to the core Omnibox code. It also undoes |
| 16 // some of the effects of using styled text in the Omnibox (the text | 16 // some of the effects of using styled text in the Omnibox (the text |
| 17 // is styled but should not appear that way when copied to the | 17 // is styled but should not appear that way when copied to the |
| 18 // pasteboard). | 18 // pasteboard). |
| 19 | 19 |
| 20 // Field editor used for the autocomplete field. | 20 // Field editor used for the autocomplete field. |
| 21 @interface AutocompleteTextFieldEditor : NSTextView<URLDropTarget> { | 21 @interface AutocompleteTextFieldEditor : NSTextView<URLDropTarget> { |
| 22 // Handles being a drag-and-drop target. We handle DnD directly instead | 22 // Handles being a drag-and-drop target. We handle DnD directly instead |
| 23 // allowing the |AutocompletTextField| to handle it (by making an empty | 23 // allowing the |AutocompletTextField| to handle it (by making an empty |
| 24 // |-updateDragTypeRegistration|), since the latter results in a weird | 24 // |-updateDragTypeRegistration|), since the latter results in a weird |
| 25 // start-up time regression. | 25 // start-up time regression. |
| 26 scoped_nsobject<URLDropTargetHandler> dropHandler_; | 26 base::scoped_nsobject<URLDropTargetHandler> dropHandler_; |
| 27 | 27 |
| 28 scoped_nsobject<NSCharacterSet> forbiddenCharacters_; | 28 base::scoped_nsobject<NSCharacterSet> forbiddenCharacters_; |
| 29 | 29 |
| 30 // Indicates if the field editor's interpretKeyEvents: method is being called. | 30 // Indicates if the field editor's interpretKeyEvents: method is being called. |
| 31 // If it's YES, then we should postpone the call to the observer's | 31 // If it's YES, then we should postpone the call to the observer's |
| 32 // OnDidChange() method after the field editor's interpretKeyEvents: method | 32 // OnDidChange() method after the field editor's interpretKeyEvents: method |
| 33 // is finished, rather than calling it in textDidChange: method. Because the | 33 // is finished, rather than calling it in textDidChange: method. Because the |
| 34 // input method may update the marked text after inserting some text, but we | 34 // input method may update the marked text after inserting some text, but we |
| 35 // need the observer be aware of the marked text as well. | 35 // need the observer be aware of the marked text as well. |
| 36 BOOL interpretingKeyEvents_; | 36 BOOL interpretingKeyEvents_; |
| 37 | 37 |
| 38 // Indicates if the text has been changed by key events. | 38 // Indicates if the text has been changed by key events. |
| 39 BOOL textChangedByKeyEvents_; | 39 BOOL textChangedByKeyEvents_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // The delegate is always an AutocompleteTextField*. Override the superclass | 42 // The delegate is always an AutocompleteTextField*. Override the superclass |
| 43 // implementations to allow for proper typing. | 43 // implementations to allow for proper typing. |
| 44 - (AutocompleteTextField*)delegate; | 44 - (AutocompleteTextField*)delegate; |
| 45 - (void)setDelegate:(AutocompleteTextField*)delegate; | 45 - (void)setDelegate:(AutocompleteTextField*)delegate; |
| 46 | 46 |
| 47 // Sets attributed string programatically through the field editor's text | 47 // Sets attributed string programatically through the field editor's text |
| 48 // storage object. | 48 // storage object. |
| 49 - (void)setAttributedString:(NSAttributedString*)aString; | 49 - (void)setAttributedString:(NSAttributedString*)aString; |
| 50 | 50 |
| 51 @end | 51 @end |
| 52 | 52 |
| 53 @interface AutocompleteTextFieldEditor(PrivateTestMethods) | 53 @interface AutocompleteTextFieldEditor(PrivateTestMethods) |
| 54 - (AutocompleteTextFieldObserver*)observer; | 54 - (AutocompleteTextFieldObserver*)observer; |
| 55 - (void)pasteAndGo:sender; | 55 - (void)pasteAndGo:sender; |
| 56 - (void)copyURL:sender; | 56 - (void)copyURL:sender; |
| 57 @end | 57 @end |
| OLD | NEW |