OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
8 #import "chrome/browser/cocoa/url_drop_target.h" | 8 #import "chrome/browser/cocoa/url_drop_target.h" |
9 | 9 |
| 10 @class AutocompleteTextField; |
10 class AutocompleteTextFieldObserver; | 11 class AutocompleteTextFieldObserver; |
11 class Profile; | 12 class Profile; |
12 | 13 |
13 // AutocompleteTextFieldEditor customized the AutocompletTextField | 14 // AutocompleteTextFieldEditor customized the AutocompletTextField |
14 // field editor (helper text-view used in editing). It intercepts UI | 15 // field editor (helper text-view used in editing). It intercepts UI |
15 // events for forwarding to the core Omnibox code. It also undoes | 16 // 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 | 17 // 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 | 18 // is styled but should not appear that way when copied to the |
18 // pasteboard). | 19 // pasteboard). |
19 | 20 |
20 // Field editor used for the autocomplete field. | 21 // Field editor used for the autocomplete field. |
21 @interface AutocompleteTextFieldEditor : NSTextView<URLDropTarget> { | 22 @interface AutocompleteTextFieldEditor : NSTextView<URLDropTarget> { |
22 // Handles being a drag-and-drop target. We handle DnD directly instead | 23 // Handles being a drag-and-drop target. We handle DnD directly instead |
23 // allowing the |AutocompletTextField| to handle it (by making an empty | 24 // allowing the |AutocompletTextField| to handle it (by making an empty |
24 // |-updateDragTypeRegistration|), since the latter results in a weird | 25 // |-updateDragTypeRegistration|), since the latter results in a weird |
25 // start-up time regression. | 26 // start-up time regression. |
26 scoped_nsobject<URLDropTargetHandler> dropHandler_; | 27 scoped_nsobject<URLDropTargetHandler> dropHandler_; |
27 | 28 |
28 // The browser profile for the editor. Weak. | 29 // The browser profile for the editor. Weak. |
29 Profile* profile_; | 30 Profile* profile_; |
30 | 31 |
31 scoped_nsobject<NSCharacterSet> forbiddenCharacters_; | 32 scoped_nsobject<NSCharacterSet> forbiddenCharacters_; |
32 } | 33 } |
33 | 34 |
34 @property(nonatomic) Profile* profile; | 35 @property(nonatomic) Profile* profile; |
35 | 36 |
| 37 // The delegate is always an AutocompleteTextField*. Override the superclass |
| 38 // implementations to allow for proper typing. |
| 39 - (AutocompleteTextField*)delegate; |
| 40 - (void)setDelegate:(AutocompleteTextField*)delegate; |
| 41 |
36 @end | 42 @end |
37 | 43 |
38 @interface AutocompleteTextFieldEditor(PrivateTestMethods) | 44 @interface AutocompleteTextFieldEditor(PrivateTestMethods) |
39 - (AutocompleteTextFieldObserver*)observer; | 45 - (AutocompleteTextFieldObserver*)observer; |
40 - (void)pasteAndGo:sender; | 46 - (void)pasteAndGo:sender; |
41 @end | 47 @end |
OLD | NEW |