| 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/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. | 125 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. |
| 126 | 126 |
| 127 // Handles being a drag-and-drop target. | 127 // Handles being a drag-and-drop target. |
| 128 base::scoped_nsobject<URLDropTargetHandler> dropHandler_; | 128 base::scoped_nsobject<URLDropTargetHandler> dropHandler_; |
| 129 | 129 |
| 130 // Holds current tooltip strings, to keep them from being dealloced. | 130 // Holds current tooltip strings, to keep them from being dealloced. |
| 131 base::scoped_nsobject<NSMutableArray> currentToolTips_; | 131 base::scoped_nsobject<NSMutableArray> currentToolTips_; |
| 132 | 132 |
| 133 // Animation object used for resizing the autocomplete field. | 133 // Animation object used for resizing the autocomplete field. |
| 134 base::scoped_nsobject<NSViewAnimation> resizeAnimation_; | 134 base::scoped_nsobject<NSViewAnimation> resizeAnimation_; |
| 135 | |
| 136 base::scoped_nsobject<NSString> suggestText_; | |
| 137 base::scoped_nsobject<NSColor> suggestColor_; | |
| 138 } | 135 } |
| 139 | 136 |
| 140 @property(nonatomic) AutocompleteTextFieldObserver* observer; | 137 @property(nonatomic) AutocompleteTextFieldObserver* observer; |
| 141 | 138 |
| 142 // Convenience method to return the cell, casted appropriately. | 139 // Convenience method to return the cell, casted appropriately. |
| 143 - (AutocompleteTextFieldCell*)cell; | 140 - (AutocompleteTextFieldCell*)cell; |
| 144 | 141 |
| 145 // Superclass aborts editing before changing the string, which causes | 142 // Superclass aborts editing before changing the string, which causes |
| 146 // problems for undo. This version modifies the field editor's | 143 // problems for undo. This version modifies the field editor's |
| 147 // contents if the control is already being edited. | 144 // contents if the control is already being edited. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 162 // of an I-beam. | 159 // of an I-beam. |
| 163 - (void)updateMouseTracking; | 160 - (void)updateMouseTracking; |
| 164 | 161 |
| 165 // Return the appropriate menu for any decoration under |event|. | 162 // Return the appropriate menu for any decoration under |event|. |
| 166 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event; | 163 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event; |
| 167 | 164 |
| 168 // Retains |tooltip| (in |currentToolTips_|) and adds this tooltip | 165 // Retains |tooltip| (in |currentToolTips_|) and adds this tooltip |
| 169 // via -[NSView addToolTipRect:owner:userData:]. | 166 // via -[NSView addToolTipRect:owner:userData:]. |
| 170 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect; | 167 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect; |
| 171 | 168 |
| 172 // Sets the suggest text that shows at the end of the field's normal text. | |
| 173 // This can't be simply appended to the field's text storage because that | |
| 174 // will end any pending IME session. | |
| 175 - (void)setGrayTextAutocompletion:(NSString*)suggestText | |
| 176 textColor:(NSColor*)suggestColor; | |
| 177 | |
| 178 - (NSString*)suggestText; | |
| 179 - (NSColor*)suggestColor; | |
| 180 | |
| 181 // Obtain the bubble anchor point for |decoration|. In window coordinates. | 169 // Obtain the bubble anchor point for |decoration|. In window coordinates. |
| 182 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration; | 170 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration; |
| 183 | 171 |
| 184 @end | 172 @end |
| 185 | 173 |
| 186 namespace autocomplete_text_field { | |
| 187 | |
| 188 // Draw gray text suggestion in |controlView|. | |
| 189 void DrawGrayTextAutocompletion(NSAttributedString* mainText, | |
| 190 NSString* suggestText, | |
| 191 NSColor* suggestColor, | |
| 192 NSView* controlView, | |
| 193 NSRect frame); | |
| 194 | |
| 195 } // namespace autocomplete_text_field | |
| 196 | |
| 197 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 174 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
| OLD | NEW |