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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "chrome/browser/cocoa/styled_text_field_cell.h" | 7 #import "chrome/browser/cocoa/styled_text_field_cell.h" |
8 | 8 |
9 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
10 #include "chrome/browser/cocoa/location_bar_view_mac.h" | 10 #include "chrome/browser/cocoa/location_bar_view_mac.h" |
11 | 11 |
| 12 class ExtensionAction; |
| 13 |
12 // AutocompleteTextFieldCell extends StyledTextFieldCell to provide support for | 14 // AutocompleteTextFieldCell extends StyledTextFieldCell to provide support for |
13 // certain decorations to be applied to the field. These are the search hint | 15 // certain decorations to be applied to the field. These are the search hint |
14 // ("Type to search" on the right-hand side), the keyword hint ("Press [Tab] to | 16 // ("Type to search" on the right-hand side), the keyword hint ("Press [Tab] to |
15 // search Engine" on the right-hand side), and keyword mode ("Search Engine:" in | 17 // search Engine" on the right-hand side), and keyword mode ("Search Engine:" in |
16 // a button-like token on the left-hand side). | 18 // a button-like token on the left-hand side). |
17 @interface AutocompleteTextFieldCell : StyledTextFieldCell { | 19 @interface AutocompleteTextFieldCell : StyledTextFieldCell { |
18 @private | 20 @private |
19 // Set if there is a string to display in a rounded rect on the | 21 // Set if there is a string to display in a rounded rect on the |
20 // left-hand side of the field. Exclusive WRT |hintString_|. | 22 // left-hand side of the field. Exclusive WRT |hintString_|. |
21 scoped_nsobject<NSAttributedString> keywordString_; | 23 scoped_nsobject<NSAttributedString> keywordString_; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 - (NSRect)securityImageFrameForFrame:(NSRect)cellFrame; | 71 - (NSRect)securityImageFrameForFrame:(NSRect)cellFrame; |
70 | 72 |
71 // Returns the portion of the cell to use for displaying the Page Action icon | 73 // Returns the portion of the cell to use for displaying the Page Action icon |
72 // at the given index. May be NSZeroRect if the index's action is not visible. | 74 // at the given index. May be NSZeroRect if the index's action is not visible. |
73 - (NSRect)pageActionFrameForIndex:(size_t)index inFrame:(NSRect)cellFrame; | 75 - (NSRect)pageActionFrameForIndex:(size_t)index inFrame:(NSRect)cellFrame; |
74 | 76 |
75 // Returns the string to be shown on hover for the Page Action icon at the | 77 // Returns the string to be shown on hover for the Page Action icon at the |
76 // given index. | 78 // given index. |
77 - (NSString*)pageActionToolTipForIndex:(size_t)index; | 79 - (NSString*)pageActionToolTipForIndex:(size_t)index; |
78 | 80 |
| 81 // Returns a pointer to the ExtensionAction object that the view at the |
| 82 // specified index represents. |
| 83 - (ExtensionAction*)pageActionForIndex:(size_t)index; |
| 84 |
79 // Called when the Page Action at the given index, whose icon is drawn in the | 85 // Called when the Page Action at the given index, whose icon is drawn in the |
80 // iconFrame, is visible and clicked. Passed through to the list of views to | 86 // iconFrame, is visible and clicked. Passed through to the list of views to |
81 // handle the click. | 87 // handle the click. |
82 - (void)onPageActionMousePressedIn:(NSRect)iconFrame forIndex:(size_t)index; | 88 - (void)onPageActionMousePressedIn:(NSRect)iconFrame forIndex:(size_t)index; |
83 | 89 |
84 @end | 90 @end |
85 | 91 |
86 // Internal methods here exposed for unit testing. | 92 // Internal methods here exposed for unit testing. |
87 @interface AutocompleteTextFieldCell (UnitTesting) | 93 @interface AutocompleteTextFieldCell (UnitTesting) |
88 | 94 |
89 @property(readonly) NSAttributedString* keywordString; | 95 @property(readonly) NSAttributedString* keywordString; |
90 @property(readonly) NSAttributedString* hintString; | 96 @property(readonly) NSAttributedString* hintString; |
91 @property(readonly) NSAttributedString* hintIconLabel; | 97 @property(readonly) NSAttributedString* hintIconLabel; |
92 | 98 |
93 @end | 99 @end |
OLD | NEW |