| 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 #ifndef CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 5 #ifndef CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
| 6 #define CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 6 #define CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import "chrome/browser/cocoa/styled_text_field.h" | 9 #import "chrome/browser/cocoa/styled_text_field.h" |
| 10 | 10 |
| 11 #include "base/scoped_nsobject.h" |
| 12 |
| 11 @class AutocompleteTextFieldCell; | 13 @class AutocompleteTextFieldCell; |
| 12 | 14 |
| 13 // AutocompleteTextField intercepts UI actions for forwarding to | 15 // AutocompleteTextField intercepts UI actions for forwarding to |
| 14 // AutocompleteEditViewMac (*), and provides a custom look. It works | 16 // AutocompleteEditViewMac (*), and provides a custom look. It works |
| 15 // together with AutocompleteTextFieldEditor (mostly for intercepting | 17 // together with AutocompleteTextFieldEditor (mostly for intercepting |
| 16 // user actions) and AutocompleteTextFieldCell (mostly for custom | 18 // user actions) and AutocompleteTextFieldCell (mostly for custom |
| 17 // drawing). | 19 // drawing). |
| 18 // | 20 // |
| 19 // For historical reasons, chrome/browser/autocomplete is the core | 21 // For historical reasons, chrome/browser/autocomplete is the core |
| 20 // implementation of the Omnibox. Chrome code seems to vary between | 22 // implementation of the Omnibox. Chrome code seems to vary between |
| (...skipping 27 matching lines...) Expand all Loading... |
| 48 // Called when the user initiates a "paste and go" or "paste and | 50 // Called when the user initiates a "paste and go" or "paste and |
| 49 // search" into |field_|. | 51 // search" into |field_|. |
| 50 virtual void OnPasteAndGo() = 0; | 52 virtual void OnPasteAndGo() = 0; |
| 51 | 53 |
| 52 // Called when the field's frame changes. | 54 // Called when the field's frame changes. |
| 53 virtual void OnFrameChanged() = 0; | 55 virtual void OnFrameChanged() = 0; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 @interface AutocompleteTextField : StyledTextField { | 58 @interface AutocompleteTextField : StyledTextField { |
| 57 @private | 59 @private |
| 60 // Undo manager for this text field. We use a specific instance rather than |
| 61 // the standard undo manager in order to let us clear the undo stack at will. |
| 62 scoped_nsobject<NSUndoManager> undoManager_; |
| 63 |
| 58 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. | 64 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. |
| 59 } | 65 } |
| 60 | 66 |
| 61 @property AutocompleteTextFieldObserver* observer; | 67 @property AutocompleteTextFieldObserver* observer; |
| 62 | 68 |
| 63 // Convenience method to return the cell, casted appropriately. | 69 // Convenience method to return the cell, casted appropriately. |
| 64 - (AutocompleteTextFieldCell*)autocompleteTextFieldCell; | 70 - (AutocompleteTextFieldCell*)autocompleteTextFieldCell; |
| 65 | 71 |
| 66 // Superclass aborts editing before changing the string, which causes | 72 // Superclass aborts editing before changing the string, which causes |
| 67 // problems for undo. This version modifies the field editor's | 73 // problems for undo. This version modifies the field editor's |
| 68 // contents if the control is already being edited. | 74 // contents if the control is already being edited. |
| 69 - (void)setAttributedStringValue:(NSAttributedString*)aString; | 75 - (void)setAttributedStringValue:(NSAttributedString*)aString; |
| 70 | 76 |
| 77 // Clears the undo chain for this text field. |
| 78 - (void)clearUndoChain; |
| 79 |
| 71 @end | 80 @end |
| 72 | 81 |
| 73 #endif // CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 82 #endif // CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
| OLD | NEW |