OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
6 #define CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 6 #define CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #import "chrome/browser/ui/cocoa/styled_text_field.h" | 11 #import "chrome/browser/ui/cocoa/styled_text_field.h" |
12 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 12 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
13 | 13 |
14 @class AutocompleteTextFieldCell; | 14 @class AutocompleteTextFieldCell; |
15 | 15 |
16 // AutocompleteTextField intercepts UI actions for forwarding to | 16 // AutocompleteTextField intercepts UI actions for forwarding to |
17 // OmniboxViewMac (*), and provides a custom look. It works | 17 // OmniboxViewMac (*), and provides a custom look. It works |
18 // together with AutocompleteTextFieldEditor (mostly for intercepting | 18 // together with AutocompleteTextFieldEditor (mostly for intercepting |
19 // user actions) and AutocompleteTextFieldCell (mostly for custom | 19 // user actions) and AutocompleteTextFieldCell (mostly for custom |
20 // drawing). | 20 // drawing). |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 protected: | 107 protected: |
108 virtual ~AutocompleteTextFieldObserver() {} | 108 virtual ~AutocompleteTextFieldObserver() {} |
109 }; | 109 }; |
110 | 110 |
111 @interface AutocompleteTextField : StyledTextField<NSTextViewDelegate, | 111 @interface AutocompleteTextField : StyledTextField<NSTextViewDelegate, |
112 URLDropTarget> { | 112 URLDropTarget> { |
113 @private | 113 @private |
114 // Undo manager for this text field. We use a specific instance rather than | 114 // Undo manager for this text field. We use a specific instance rather than |
115 // the standard undo manager in order to let us clear the undo stack at will. | 115 // the standard undo manager in order to let us clear the undo stack at will. |
116 scoped_nsobject<NSUndoManager> undoManager_; | 116 base::scoped_nsobject<NSUndoManager> undoManager_; |
117 | 117 |
118 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. | 118 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. |
119 | 119 |
120 // Handles being a drag-and-drop target. | 120 // Handles being a drag-and-drop target. |
121 scoped_nsobject<URLDropTargetHandler> dropHandler_; | 121 base::scoped_nsobject<URLDropTargetHandler> dropHandler_; |
122 | 122 |
123 // Holds current tooltip strings, to keep them from being dealloced. | 123 // Holds current tooltip strings, to keep them from being dealloced. |
124 scoped_nsobject<NSMutableArray> currentToolTips_; | 124 base::scoped_nsobject<NSMutableArray> currentToolTips_; |
125 | 125 |
126 scoped_nsobject<NSString> suggestText_; | 126 base::scoped_nsobject<NSString> suggestText_; |
127 scoped_nsobject<NSColor> suggestColor_; | 127 base::scoped_nsobject<NSColor> suggestColor_; |
128 } | 128 } |
129 | 129 |
130 @property(nonatomic) AutocompleteTextFieldObserver* observer; | 130 @property(nonatomic) AutocompleteTextFieldObserver* observer; |
131 | 131 |
132 // Convenience method to return the cell, casted appropriately. | 132 // Convenience method to return the cell, casted appropriately. |
133 - (AutocompleteTextFieldCell*)cell; | 133 - (AutocompleteTextFieldCell*)cell; |
134 | 134 |
135 // Superclass aborts editing before changing the string, which causes | 135 // Superclass aborts editing before changing the string, which causes |
136 // problems for undo. This version modifies the field editor's | 136 // problems for undo. This version modifies the field editor's |
137 // contents if the control is already being edited. | 137 // contents if the control is already being edited. |
(...skipping 30 matching lines...) Expand all Loading... |
168 // Draw instant suggestion text in |controlView|. | 168 // Draw instant suggestion text in |controlView|. |
169 void DrawInstantSuggestion(NSAttributedString* mainText, | 169 void DrawInstantSuggestion(NSAttributedString* mainText, |
170 NSString* suggestText, | 170 NSString* suggestText, |
171 NSColor* suggestColor, | 171 NSColor* suggestColor, |
172 NSView* controlView, | 172 NSView* controlView, |
173 NSRect frame); | 173 NSRect frame); |
174 | 174 |
175 } // namespace autocomplete_text_field | 175 } // namespace autocomplete_text_field |
176 | 176 |
177 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 177 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
OLD | NEW |