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

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

Issue 606079: [Mac] Adds grippys to the left side of the Browser Actions container to resiz... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « chrome/browser/cocoa/extensions/browser_actions_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/toolbar_controller.mm
===================================================================
--- chrome/browser/cocoa/toolbar_controller.mm (revision 39220)
+++ chrome/browser/cocoa/toolbar_controller.mm (working copy)
@@ -22,6 +22,7 @@
#import "chrome/browser/cocoa/background_gradient_view.h"
#import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h"
#import "chrome/browser/cocoa/extensions/browser_action_button.h"
+#import "chrome/browser/cocoa/extensions/browser_actions_container_view.h"
#import "chrome/browser/cocoa/extensions/browser_actions_controller.h"
#import "chrome/browser/cocoa/gradient_button_cell.h"
#import "chrome/browser/cocoa/location_bar_view_mac.h"
@@ -222,7 +223,7 @@
name:NSWindowDidResizeNotification
object:[[self view] window]];
// Register pref observers for the optional home and page/options buttons
- // and then add them to the toolbar them based on those prefs.
+ // and then add them to the toolbar based on those prefs.
prefObserver_.reset(new ToolbarControllerInternal::PrefObserverBridge(self));
PrefService* prefs = profile_->GetPrefs();
showHomeButton_.Init(prefs::kShowHomeButton, prefs, prefObserver_.get());
@@ -576,11 +577,6 @@
CGFloat moveX = 2 * [self interButtonSpacing] + NSWidth([pageButton_ frame]) +
NSWidth([wrenchButton_ frame]);
- // Adjust for the extra unit of inter-button spacing added when the page and
- // wrench buttons are hidden.
- if ([browserActionsController_ visibleButtonCount] > 0)
- moveX -= [self interButtonSpacing];
-
if (!hide)
moveX *= -1; // Reverse the direction of the move.
@@ -588,6 +584,7 @@
[browserActionsContainerView_ setFrame:NSOffsetRect(
[browserActionsContainerView_ frame], moveX, 0)];
+ [browserActionsContainerView_ setRightBorderShown:!hide];
[pageButton_ setHidden:hide];
[wrenchButton_ setHidden:hide];
}
@@ -604,6 +601,8 @@
- (void)createBrowserActionButtons {
[browserActionsController_ createButtons];
[self showOrHideBrowserActionButtons];
+ BOOL rightBorderShown = !([pageButton_ isHidden] && [wrenchButton_ isHidden]);
+ [browserActionsContainerView_ setRightBorderShown:rightBorderShown];
}
- (void)showOrHideBrowserActionButtons {
@@ -654,35 +653,11 @@
}
- (void)browserActionsChanged {
- // Calculate the new width.
- int buttonCount = [browserActionsController_ visibleButtonCount];
-
- CGFloat width = 0.0;
- if (buttonCount > 0)
- width = buttonCount * (kBrowserActionWidth + kBrowserActionButtonPadding);
-
+ CGFloat width = [browserActionsController_ idealContainerWidth];
NSRect containerFrame = [browserActionsContainerView_ frame];
- CGFloat buttonSpacing = [self interButtonSpacing];
CGFloat dX = containerFrame.size.width - width;
containerFrame.size.width = width;
- bool addingButton = (dX < 0);
- // If a button is being added, add spacing inward by negating the value.
- if (addingButton)
- buttonSpacing *= -1;
-
- // If the first button is being added or the last button is being removed,
- // then account for the right padding it will need.
- if ((buttonCount == 1 && addingButton) ||
- (buttonCount == 0 && !addingButton)) {
- dX += buttonSpacing;
- // The offset of the buttons from the right side will be one button spacing
- // unit more than if the wrench and page buttons were shown.
- if ([pageButton_ isHidden] && [wrenchButton_ isHidden]) {
- dX += buttonSpacing;
- }
- }
-
[browserActionsContainerView_ setFrame:NSOffsetRect(containerFrame, dX, 0)];
[self adjustLocationAndGoPositionsBy:dX];
}
« no previous file with comments | « chrome/browser/cocoa/extensions/browser_actions_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698