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

Unified Diff: chrome/browser/cocoa/autocomplete_text_field_cell.mm

Issue 1540009: [Mac] Move star button into page-actions area of omnibox. (Closed)
Patch Set: Why did the trybot fail? I can't see anything. Created 10 years, 9 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/autocomplete_text_field_cell.mm
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell.mm b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
index 7c0c27f012ffa769ab585926e2629eb25a109091..699a59ba0f236577e1c517ce0c908a7430855f65 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_cell.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
@@ -272,6 +272,10 @@ void DrawImageInRect(NSImage* image, NSView* view, const NSRect& rect) {
locationIconView_ = view;
}
+- (void)setStarIconView:(LocationBarViewMac::LocationBarImageView*)view {
+ starIconView_ = view;
+}
+
- (void)setSecurityLabelView:(LocationBarViewMac::LocationBarImageView*)view {
securityLabelView_ = view;
}
@@ -340,6 +344,18 @@ void DrawImageInRect(NSImage* image, NSView* view, const NSRect& rect) {
imageSize.width, imageSize.height);
}
+- (NSRect)starIconFrameForFrame:(NSRect)cellFrame {
+ if (!starIconView_ || !starIconView_->IsVisible())
+ return NSZeroRect;
+
+ // The star icon is always at the RHS.
+ scoped_nsobject<AutocompleteTextFieldIcon> icon(
+ [[AutocompleteTextFieldIcon alloc] initImageWithView:starIconView_]);
+ cellFrame.size.width -= kHintXOffset;
+ [icon positionInFrame:cellFrame];
+ return [icon rect];
+}
+
- (size_t)pageActionCount {
// page_action_views_ may be NULL during testing, or if the
// containing LocationViewMac object has already been destructed
@@ -471,6 +487,10 @@ void DrawImageInRect(NSImage* image, NSView* view, const NSRect& rect) {
views.push_back(page_action_views_->ViewAt(i));
}
+ // The star icon should always come last.
+ if (starIconView_)
+ views.push_back(starIconView_);
+
// Load the visible views into |result|.
for (std::vector<LocationBarViewMac::LocationBarImageView*>::const_iterator
iter = views.begin(); iter != views.end(); ++iter) {
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell.h ('k') | chrome/browser/cocoa/bookmark_bubble_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698