| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 scoped_nsobject<NSAttributedString> keywordString_; | 21 scoped_nsobject<NSAttributedString> keywordString_; |
| 22 | 22 |
| 23 // Set if there is a string to display as a hint on the right-hand | 23 // Set if there is a string to display as a hint on the right-hand |
| 24 // side of the field. Exclusive WRT |keywordString_|; | 24 // side of the field. Exclusive WRT |keywordString_|; |
| 25 scoped_nsobject<NSAttributedString> hintString_; | 25 scoped_nsobject<NSAttributedString> hintString_; |
| 26 | 26 |
| 27 // View showing the state of the SSL connection. Owned by the location bar. | 27 // View showing the state of the SSL connection. Owned by the location bar. |
| 28 // Display is exclusive WRT the |hintString_| and |keywordString_|. | 28 // Display is exclusive WRT the |hintString_| and |keywordString_|. |
| 29 // This may be NULL during testing. | 29 // This may be NULL during testing. |
| 30 LocationBarViewMac::SecurityImageView* security_image_view_; | 30 LocationBarViewMac::SecurityImageView* security_image_view_; |
| 31 |
| 32 // List of views showing visible Page Actions. Owned by the location bar. |
| 33 // Display is exclusive WRT the |hintString_| and |keywordString_|. |
| 34 // This may be NULL during testing. |
| 35 LocationBarViewMac::PageActionViewList* page_action_views_; |
| 31 } | 36 } |
| 32 | 37 |
| 33 // Chooses |partialString| if |width| won't fit |fullString|. Strings | 38 // Chooses |partialString| if |width| won't fit |fullString|. Strings |
| 34 // must be non-nil. | 39 // must be non-nil. |
| 35 - (void)setKeywordString:(NSString*)fullString | 40 - (void)setKeywordString:(NSString*)fullString |
| 36 partialString:(NSString*)partialString | 41 partialString:(NSString*)partialString |
| 37 availableWidth:(CGFloat)width; | 42 availableWidth:(CGFloat)width; |
| 38 | 43 |
| 39 // Chooses |anImage| only if all pieces won't fit w/in |width|. | 44 // Chooses |anImage| only if all pieces won't fit w/in |width|. |
| 40 // Inputs must be non-nil. | 45 // Inputs must be non-nil. |
| 41 - (void)setKeywordHintPrefix:(NSString*)prefixString | 46 - (void)setKeywordHintPrefix:(NSString*)prefixString |
| 42 image:(NSImage*)anImage | 47 image:(NSImage*)anImage |
| 43 suffix:(NSString*)suffixString | 48 suffix:(NSString*)suffixString |
| 44 availableWidth:(CGFloat)width; | 49 availableWidth:(CGFloat)width; |
| 45 | 50 |
| 46 // Suppresses hint entirely if |aString| won't fit w/in |width|. | 51 // Suppresses hint entirely if |aString| won't fit w/in |width|. |
| 47 // String must be non-nil. | 52 // String must be non-nil. |
| 48 - (void)setSearchHintString:(NSString*)aString | 53 - (void)setSearchHintString:(NSString*)aString |
| 49 availableWidth:(CGFloat)width; | 54 availableWidth:(CGFloat)width; |
| 50 - (void)clearKeywordAndHint; | 55 - (void)clearKeywordAndHint; |
| 51 | 56 |
| 52 - (void)setSecurityImageView:(LocationBarViewMac::SecurityImageView*)view; | 57 - (void)setSecurityImageView:(LocationBarViewMac::SecurityImageView*)view; |
| 58 - (void)setPageActionViewList:(LocationBarViewMac::PageActionViewList*)list; |
| 59 |
| 60 // Returns the total number of installed Page Actions, visible or not. |
| 61 - (size_t)pageActionCount; |
| 53 | 62 |
| 54 // Called when the security icon is visible and clicked. Passed through to the | 63 // Called when the security icon is visible and clicked. Passed through to the |
| 55 // security_image_view_ to handle the click (i.e., show the page info dialog). | 64 // security_image_view_ to handle the click (i.e., show the page info dialog). |
| 56 - (void)onSecurityIconMousePressed; | 65 - (void)onSecurityIconMousePressed; |
| 57 | 66 |
| 58 // Return the portion of the cell to use for displaying the security (SSL lock) | 67 // Returns the portion of the cell to use for displaying the security (SSL lock) |
| 59 // icon, leaving space for its label if any. | 68 // icon, leaving space for its label if any. |
| 60 - (NSRect)securityImageFrameForFrame:(NSRect)cellFrame; | 69 - (NSRect)securityImageFrameForFrame:(NSRect)cellFrame; |
| 61 | 70 |
| 71 // 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. |
| 73 - (NSRect)pageActionFrameForIndex:(size_t)index inFrame:(NSRect)cellFrame; |
| 74 |
| 75 // Called when the Page Action at the given index, whose icon is drawn in the |
| 76 // iconFrame, is visible and clicked. Passed through to the list of views to |
| 77 // handle the click. |
| 78 - (void)onPageActionMousePressedIn:(NSRect)iconFrame forIndex:(size_t)index; |
| 79 |
| 62 @end | 80 @end |
| 63 | 81 |
| 64 // Internal methods here exposed for unit testing. | 82 // Internal methods here exposed for unit testing. |
| 65 @interface AutocompleteTextFieldCell (UnitTesting) | 83 @interface AutocompleteTextFieldCell (UnitTesting) |
| 66 | 84 |
| 67 @property(readonly) NSAttributedString* keywordString; | 85 @property(readonly) NSAttributedString* keywordString; |
| 68 @property(readonly) NSAttributedString* hintString; | 86 @property(readonly) NSAttributedString* hintString; |
| 69 @property(readonly) NSAttributedString* hintIconLabel; | 87 @property(readonly) NSAttributedString* hintIconLabel; |
| 70 | 88 |
| 71 @end | 89 @end |
| OLD | NEW |