| 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" |
| 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/themed_window.h" |
| 12 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 13 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 13 | 14 |
| 14 @class AutocompleteTextFieldCell; | 15 @class AutocompleteTextFieldCell; |
| 15 class LocationBarDecoration; | 16 class LocationBarDecoration; |
| 16 | 17 |
| 17 // AutocompleteTextField intercepts UI actions for forwarding to | 18 // AutocompleteTextField intercepts UI actions for forwarding to |
| 18 // OmniboxViewMac (*), and provides a custom look. It works | 19 // OmniboxViewMac (*), and provides a custom look. It works |
| 19 // together with AutocompleteTextFieldEditor (mostly for intercepting | 20 // together with AutocompleteTextFieldEditor (mostly for intercepting |
| 20 // user actions) and AutocompleteTextFieldCell (mostly for custom | 21 // user actions) and AutocompleteTextFieldCell (mostly for custom |
| 21 // drawing). | 22 // drawing). |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 virtual void OnMouseDown(NSInteger button_number) = 0; | 111 virtual void OnMouseDown(NSInteger button_number) = 0; |
| 111 | 112 |
| 112 // Returns true if mouse down should select all. | 113 // Returns true if mouse down should select all. |
| 113 virtual bool ShouldSelectAllOnMouseDown() = 0; | 114 virtual bool ShouldSelectAllOnMouseDown() = 0; |
| 114 | 115 |
| 115 protected: | 116 protected: |
| 116 virtual ~AutocompleteTextFieldObserver() {} | 117 virtual ~AutocompleteTextFieldObserver() {} |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 @interface AutocompleteTextField : StyledTextField<NSTextViewDelegate, | 120 @interface AutocompleteTextField : StyledTextField<NSTextViewDelegate, |
| 120 URLDropTarget> { | 121 URLDropTarget, |
| 122 ThemedWindowDrawing> { |
| 121 @private | 123 @private |
| 122 // Undo manager for this text field. We use a specific instance rather than | 124 // Undo manager for this text field. We use a specific instance rather than |
| 123 // the standard undo manager in order to let us clear the undo stack at will. | 125 // the standard undo manager in order to let us clear the undo stack at will. |
| 124 base::scoped_nsobject<NSUndoManager> undoManager_; | 126 base::scoped_nsobject<NSUndoManager> undoManager_; |
| 125 | 127 |
| 126 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. | 128 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. |
| 127 | 129 |
| 128 // Handles being a drag-and-drop target. | 130 // Handles being a drag-and-drop target. |
| 129 base::scoped_nsobject<URLDropTargetHandler> dropHandler_; | 131 base::scoped_nsobject<URLDropTargetHandler> dropHandler_; |
| 130 | 132 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // Draw gray text suggestion in |controlView|. | 191 // Draw gray text suggestion in |controlView|. |
| 190 void DrawGrayTextAutocompletion(NSAttributedString* mainText, | 192 void DrawGrayTextAutocompletion(NSAttributedString* mainText, |
| 191 NSString* suggestText, | 193 NSString* suggestText, |
| 192 NSColor* suggestColor, | 194 NSColor* suggestColor, |
| 193 NSView* controlView, | 195 NSView* controlView, |
| 194 NSRect frame); | 196 NSRect frame); |
| 195 | 197 |
| 196 } // namespace autocomplete_text_field | 198 } // namespace autocomplete_text_field |
| 197 | 199 |
| 198 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 200 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
| OLD | NEW |