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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm

Issue 14262013: On Mac, ensure messages displayed in the bookmark bar do not overlap with the Apps bookmark button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Answered comments, added tests. Created 7 years, 8 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/ui/cocoa/bookmarks/bookmark_bar_controller.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
index ebe9f30dfa53436aa744541f76d1a89b70edf8a2..bd896f728d748a24c0836589abfe054fe514f006 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
@@ -1387,17 +1387,24 @@ void RecordAppLaunch(Profile* profile, GURL url) {
}
-// Adjust the horizontal width and the visibility of the "For quick access"
-// text field and "Import bookmarks..." button based on the current width
-// of the containing |buttonView_| (which is affected by window width).
-- (void)adjustNoItemContainerWidthsForMaxX:(CGFloat)maxViewX {
+// Adjust the horizontal width, x position and the visibility of the "For quick
+// access" text field and "Import bookmarks..." button based on the current
+// width of the containing |buttonView_| (which is affected by window width).
+- (void)adjustNoItemContainerForMaxX:(CGFloat)maxViewX {
if (![[buttonView_ noItemContainer] isHidden]) {
// Reset initial frames for the two items, then adjust as necessary.
NSTextField* noItemTextfield = [buttonView_ noItemTextfield];
- [noItemTextfield setFrame:originalNoItemsRect_];
+ NSRect noItemsRect = originalNoItemsRect_;
+ NSRect importBookmarksRect = originalImportBookmarksRect_;
+ if (![appsPageShortcutButton_ isHidden]) {
+ float width = NSWidth([appsPageShortcutButton_ frame]);
+ noItemsRect.origin.x += width;
+ importBookmarksRect.origin.x += width;
+ }
+ [noItemTextfield setFrame:noItemsRect];
[noItemTextfield setHidden:NO];
NSButton* importBookmarksButton = [buttonView_ importBookmarksButton];
- [importBookmarksButton setFrame:originalImportBookmarksRect_];
+ [importBookmarksButton setFrame:importBookmarksRect];
[importBookmarksButton setHidden:NO];
// Check each to see if they need to be shrunk or hidden.
if ([self shrinkOrHideView:importBookmarksButton forMaxX:maxViewX])
@@ -1518,7 +1525,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
// While we're here, adjust the horizontal width and the visibility
// of the "For quick access" and "Import bookmarks..." text fields.
if (![buttons_ count])
- [self adjustNoItemContainerWidthsForMaxX:maxViewX];
+ [self adjustNoItemContainerForMaxX:maxViewX];
}
#pragma mark Private Methods Exposed for Testing
@@ -1535,10 +1542,18 @@ void RecordAppLaunch(Profile* profile, GURL url) {
return offTheSideButton_;
}
+- (NSButton*)appsPageShortcutButton {
+ return appsPageShortcutButton_;
+}
+
- (BOOL)offTheSideButtonIsHidden {
return [offTheSideButton_ isHidden];
}
+- (BOOL)appsPageShortcutButtonIsHidden {
+ return [appsPageShortcutButton_ isHidden];
+}
+
- (BookmarkButton*)otherBookmarksButton {
return otherBookmarksButton_.get();
}

Powered by Google App Engine
This is Rietveld 408576698