| Index: chrome/browser/cocoa/autocomplete_text_field_cell.h
|
| diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell.h b/chrome/browser/cocoa/autocomplete_text_field_cell.h
|
| index 6b2f156a901a9855419687ce74c9d0c97595e5cb..a57a2ad1533745bb7bcb7aebddbb13e02aae4b70 100644
|
| --- a/chrome/browser/cocoa/autocomplete_text_field_cell.h
|
| +++ b/chrome/browser/cocoa/autocomplete_text_field_cell.h
|
| @@ -13,7 +13,15 @@ class ExtensionAction;
|
|
|
| // Holds a |LocationBarImageView| and its current rect. Do not keep references
|
| // to this object, only use it directly after calling |-layedOutIcons:|.
|
| +// TODO(shess): This class is basically a helper for laying out the
|
| +// icons. Try to refactor it away. If that is not reasonable, at
|
| +// least split the image and label cases into subclasses once the
|
| +// Omnibox stuff is settled.
|
| @interface AutocompleteTextFieldIcon : NSObject {
|
| + // YES to draw the label part of |view_|, otherwise draw the image
|
| + // part.
|
| + BOOL isLabel_;
|
| +
|
| // The frame rect of |view_|.
|
| NSRect rect_;
|
|
|
| @@ -21,12 +29,20 @@ class ExtensionAction;
|
| LocationBarViewMac::LocationBarImageView* view_;
|
| }
|
|
|
| -// Returns a new AutocompleteTextFieldIcon object.
|
| -+ (AutocompleteTextFieldIcon*)
|
| - iconWithRect:(NSRect)rect
|
| - view:(LocationBarViewMac::LocationBarImageView*)view;
|
| @property(assign, nonatomic) NSRect rect;
|
| @property(assign, nonatomic) LocationBarViewMac::LocationBarImageView* view;
|
| +
|
| +- (id)initImageWithView:(LocationBarViewMac::LocationBarImageView*)view;
|
| +- (id)initLabelWithView:(LocationBarViewMac::LocationBarImageView*)view;
|
| +
|
| +// Position |view_| right-justified in |frame|.
|
| +- (void)positionInFrame:(NSRect)frame;
|
| +
|
| +// Draw image or label of |view_| in |rect_| within |controlView|.
|
| +// Only call after |-positionInFrame:| has set |rect_| (or after an
|
| +// explicit |-setRect:|).
|
| +- (void)drawInView:(NSView*)controlView;
|
| +
|
| @end
|
|
|
| // AutocompleteTextFieldCell extends StyledTextFieldCell to provide support for
|
| @@ -44,9 +60,13 @@ class ExtensionAction;
|
| // side of the field. Exclusive WRT |keywordString_|;
|
| scoped_nsobject<NSAttributedString> hintString_;
|
|
|
| - // View showing an icon matching the current text. Owned by the location bar.
|
| - // Exclusive WRT |keywordString_|. This may be NULL during testing.
|
| - LocationBarViewMac::LocationIconView* location_icon_view_;
|
| + // The location icon sits at the left-hand side of the field.
|
| + // |keywordString_| overrides.
|
| + LocationBarViewMac::LocationIconView* locationIconView_;
|
| +
|
| + // The security label floats to the left of page actions at the
|
| + // right-hand side.
|
| + LocationBarViewMac::LocationBarImageView* securityLabelView_;
|
|
|
| // List of views showing visible Page Actions. Owned by the location bar.
|
| // Display is exclusive WRT the |hintString_| and |keywordString_|.
|
| @@ -77,6 +97,7 @@ class ExtensionAction;
|
| - (void)clearKeywordAndHint;
|
|
|
| - (void)setLocationIconView:(LocationBarViewMac::LocationIconView*)view;
|
| +- (void)setSecurityLabelView:(LocationBarViewMac::LocationBarImageView*)view;
|
| - (void)setPageActionViewList:(LocationBarViewMac::PageActionViewList*)list;
|
| - (void)setContentSettingViewsList:
|
| (LocationBarViewMac::ContentSettingViews*)views;
|
| @@ -85,20 +106,31 @@ class ExtensionAction;
|
| // only visible icons.
|
| - (NSArray*)layedOutIcons:(NSRect)cellFrame;
|
|
|
| -
|
| -// Returns the portion of the cell to use for displaying the Page Action icon
|
| -// at the given index. May be NSZeroRect if the index's action is not visible.
|
| -// This does a linear walk over all page actions, so do not call this in a loop
|
| -// to get the position of all page actions. Use |-layedOutIcons:| instead in that
|
| -// case.
|
| +// Returns the portion of the cell to use for displaying the Page
|
| +// Action icon at the given index. May be NSZeroRect if the index's
|
| +// action is not visible. This does a linear walk over all page
|
| +// actions, so do not call this in a loop to get the position of all
|
| +// page actions. Use |-layedOutIcons:| instead in that case.
|
| - (NSRect)pageActionFrameForIndex:(size_t)index inFrame:(NSRect)cellFrame;
|
|
|
| +// Find the icon under the event. |nil| if |theEvent| is not over
|
| +// anything.
|
| +- (AutocompleteTextFieldIcon*)iconForEvent:(NSEvent*)theEvent
|
| + inRect:(NSRect)cellFrame
|
| + ofView:(AutocompleteTextField*)controlView;
|
| +
|
| // Return the appropriate menu for any page actions under event.
|
| // Returns nil if no menu is present for the action, or if the event
|
| // is not over an action.
|
| -- (NSMenu*)actionMenuForEvent:(NSEvent*)event
|
| +- (NSMenu*)actionMenuForEvent:(NSEvent*)theEvent
|
| inRect:(NSRect)cellFrame
|
| - ofView:(NSView*)aView;
|
| + ofView:(AutocompleteTextField*)controlView;
|
| +
|
| +// Called by |AutocompleteTextField| to let page actions intercept
|
| +// clicks. Returns |YES| if the click has been intercepted.
|
| +- (BOOL)mouseDown:(NSEvent*)theEvent
|
| + inRect:(NSRect)cellFrame
|
| + ofView:(AutocompleteTextField*)controlView;
|
|
|
| @end
|
|
|
| @@ -112,8 +144,8 @@ class ExtensionAction;
|
| // Returns the total number of installed Page Actions, visible or not.
|
| - (size_t)pageActionCount;
|
|
|
| -// Returns the portion of the cell to use for displaying the location icon,
|
| -// leaving space for its label if any.
|
| +// Returns the portion of the cell to use for displaying the location
|
| +// icon.
|
| - (NSRect)locationIconFrameForFrame:(NSRect)cellFrame;
|
|
|
| @end
|
|
|