Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h

Issue 2805070: [Mac] First part of Omnibox decoration refactor. Enable ev bubble. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: comment clarification Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h
diff --git a/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h b/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h
index 6a43aec98d19153127cd98040723dad8b10f3370..8e855303aa3d439d238f68859715c6bfaddeff9a 100644
--- a/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h
+++ b/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h
@@ -10,6 +10,7 @@
#include "chrome/browser/cocoa/location_bar/location_bar_view_mac.h"
class ExtensionAction;
+class LocationBarDecoration;
// Holds a |LocationBarImageView| and its current rect. Do not keep references
// to this object, only use it directly after calling |-layedOutIcons:|.
@@ -52,26 +53,18 @@ class ExtensionAction;
// a button-like token on the left-hand side).
@interface AutocompleteTextFieldCell : StyledTextFieldCell {
@private
- // Set if there is a string to display in a rounded rect on the
- // left-hand side of the field. Exclusive WRT |hintString_|.
- scoped_nsobject<NSAttributedString> keywordString_;
+ // Decorations which live to the left of the text. Owned by
+ // |LocationBarViewMac|.
+ std::vector<LocationBarDecoration*> leftDecorations_;
// Set if there is a string to display as a hint on the right-hand
// side of the field. Exclusive WRT |keywordString_|;
scoped_nsobject<NSAttributedString> hintString_;
- // The location icon sits at the left-hand side of the field.
- // |keywordString_| overrides.
- LocationBarViewMac::LocationIconView* locationIconView_;
-
// The star icon sits at the right-hand side of the field when an
// URL is being shown.
LocationBarViewMac::LocationBarImageView* starIconView_;
- // 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_|.
// This may be NULL during testing.
@@ -81,12 +74,6 @@ class ExtensionAction;
LocationBarViewMac::ContentSettingViews* content_setting_views_;
}
-// Chooses |partialString| if |width| won't fit |fullString|. Strings
-// must be non-nil.
-- (void)setKeywordString:(NSString*)fullString
- partialString:(NSString*)partialString
- availableWidth:(CGFloat)width;
-
// Chooses |anImage| only if all pieces won't fit w/in |width|.
// Inputs must be non-nil.
- (void)setKeywordHintPrefix:(NSString*)prefixString
@@ -98,19 +85,23 @@ class ExtensionAction;
// String must be non-nil.
- (void)setSearchHintString:(NSString*)aString
availableWidth:(CGFloat)width;
-- (void)clearKeywordAndHint;
+- (void)clearHint;
+
+// Clear |leftDecorations_|.
+- (void)clearDecorations;
+
+// Add a new left-side decoration to the right of the existing
+// left-side decorations.
+- (void)addLeftDecoration:(LocationBarDecoration*)decoration;
+
+// The width available after accounting for decorations.
+- (CGFloat)availableWidthInFrame:(const NSRect)frame;
-- (void)setLocationIconView:(LocationBarViewMac::LocationIconView*)view;
- (void)setStarIconView:(LocationBarViewMac::LocationBarImageView*)view;
-- (void)setSecurityLabelView:(LocationBarViewMac::LocationBarImageView*)view;
- (void)setPageActionViewList:(LocationBarViewMac::PageActionViewList*)list;
- (void)setContentSettingViewsList:
(LocationBarViewMac::ContentSettingViews*)views;
-// Returns the portion of the cell to use for displaying the location
-// icon.
-- (NSRect)locationIconFrameForFrame:(NSRect)cellFrame;
-
// Returns an array of the visible AutocompleteTextFieldIcon objects. Returns
// only visible icons.
- (NSArray*)layedOutIcons:(NSRect)cellFrame;
@@ -119,6 +110,12 @@ class ExtensionAction;
// positioning the bookmark bubble.
- (NSRect)starIconFrameForFrame:(NSRect)cellFrame;
+// Return the frame for |aDecoration| if the cell is in |cellFrame|.
+// Returns |NSZeroRect| for decorations which are not currently
+// visible.
+- (NSRect)frameForDecoration:(const LocationBarDecoration*)aDecoration
+ inFrame:(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
@@ -150,15 +147,11 @@ class ExtensionAction;
inRect:(NSRect)cellFrame
ofView:(AutocompleteTextField*)controlView;
-// If the location icon is draggable, return its drag pasteboard.
-- (NSPasteboard*)locationDragPasteboard;
-
@end
// Internal methods here exposed for unit testing.
@interface AutocompleteTextFieldCell (UnitTesting)
-@property(nonatomic, readonly) NSAttributedString* keywordString;
@property(nonatomic, readonly) NSAttributedString* hintString;
@property(nonatomic, readonly) NSAttributedString* hintIconLabel;

Powered by Google App Engine
This is Rietveld 408576698