Chromium Code Reviews| Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| index 32e28585cba50df16b5ff4eb1c8957a53e207730..4a42eefaa6b6b575fabb392dc2bf5a288cd1917e 100644 |
| --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| @@ -79,22 +79,22 @@ |
| // Duration of the toolbar animation. |
| const NSTimeInterval kToolBarAnimationDuration = 0.12; |
| -// The height of the location bar in Material Design. |
| -const CGFloat kMaterialDesignLocationBarHeight = 28; |
| +// The height of the location bar. |
| +const CGFloat kLocationBarHeight = 28; |
| // The padding between the top of the toolbar and the top of the |
| // location bar. |
| -const CGFloat kMaterialDesignLocationBarPadding = 2; |
| +const CGFloat kLocationBarPadding = 2; |
| -// The padding between Material Design elements and the edges of the toolbar. |
| -const CGFloat kMaterialDesignElementPadding = 4; |
| +// The padding between elements and the edges of the toolbar. |
| +const CGFloat kElementPadding = 4; |
| // Toolbar buttons are 24x24 and centered in a 28x28 space, so there is a 2pt- |
| // wide inset. |
| -const CGFloat kMaterialDesignButtonInset = 2; |
| +const CGFloat kButtonInset = 2; |
| // The y-offset of the browser actions container from the location bar. |
| -const CGFloat kMaterialDesignContainerYOffset = 2; |
| +const CGFloat kContainerYOffset = 2; |
| // The minimum width of the location bar in pixels. |
| const CGFloat kMinimumLocationBarWidth = 100.0; |
| @@ -230,15 +230,15 @@ @implementation ToolbarController |
| @synthesize browser = browser_; |
| + (CGFloat)locationBarHeight { |
| - return kMaterialDesignLocationBarHeight; |
| + return kLocationBarHeight; |
| } |
| + (CGFloat)appMenuLeftPadding { |
| - return kMaterialDesignElementPadding; |
| + return kElementPadding; |
| } |
| + (CGFloat)materialDesignButtonInset { |
| - return kMaterialDesignButtonInset; |
| + return kButtonInset; |
| } |
| - (id)initWithCommands:(CommandUpdater*)commands |
| @@ -305,29 +305,29 @@ - (void)viewDidLoad { |
| NSRect backButtonFrame = [backButton_ frame]; |
| backButtonFrame.origin.x = |
| - kMaterialDesignElementPadding + kMaterialDesignButtonInset; |
| + kElementPadding + kButtonInset; |
|
Avi (use Gerrit)
2016/09/28 16:01:58
Some of these can be rewrapped. Try a clang format
Elly Fong-Jones
2016/09/28 19:02:27
Done.
|
| backButtonFrame.origin.y = NSMaxY(toolbarBounds) - |
| - kMaterialDesignElementPadding - toolbarButtonSize.height; |
| + kElementPadding - toolbarButtonSize.height; |
| backButtonFrame.size = toolbarButtonSize; |
| [backButton_ setFrame:backButtonFrame]; |
| NSRect forwardButtonFrame = [forwardButton_ frame]; |
| forwardButtonFrame.origin.x = |
| - NSMaxX(backButtonFrame) + 2 * kMaterialDesignButtonInset; |
| + NSMaxX(backButtonFrame) + 2 * kButtonInset; |
| forwardButtonFrame.origin.y = backButtonFrame.origin.y; |
| forwardButtonFrame.size = toolbarButtonSize; |
| [forwardButton_ setFrame:forwardButtonFrame]; |
| NSRect reloadButtonFrame = [reloadButton_ frame]; |
| reloadButtonFrame.origin.x = |
| - NSMaxX(forwardButtonFrame) + 2 * kMaterialDesignButtonInset; |
| + NSMaxX(forwardButtonFrame) + 2 * kButtonInset; |
| reloadButtonFrame.origin.y = forwardButtonFrame.origin.y; |
| reloadButtonFrame.size = toolbarButtonSize; |
| [reloadButton_ setFrame:reloadButtonFrame]; |
| NSRect homeButtonFrame = [homeButton_ frame]; |
| homeButtonFrame.origin.x = |
| - NSMaxX(reloadButtonFrame) + 2 * kMaterialDesignButtonInset; |
| + NSMaxX(reloadButtonFrame) + 2 * kButtonInset; |
| homeButtonFrame.origin.y = reloadButtonFrame.origin.y; |
| homeButtonFrame.size = toolbarButtonSize; |
| [homeButton_ setFrame:homeButtonFrame]; |
| @@ -347,7 +347,7 @@ - (void)viewDidLoad { |
| CGFloat menuButtonFrameMaxX = |
| NSMaxX(toolbarBounds) - [ToolbarController appMenuLeftPadding]; |
| menuButtonFrame.origin.x = |
| - menuButtonFrameMaxX - kMaterialDesignButtonInset - |
| + menuButtonFrameMaxX - kButtonInset - |
| toolbarButtonSize.width; |
| menuButtonFrame.origin.y = homeButtonFrame.origin.y; |
| menuButtonFrame.size = toolbarButtonSize; |
| @@ -357,24 +357,24 @@ - (void)viewDidLoad { |
| // space between the reload and menu buttons. |
| NSRect locationBarFrame = [locationBar_ frame]; |
| locationBarFrame.origin.x = NSMaxX(homeButtonFrame) + |
| - kMaterialDesignButtonInset; |
| + kButtonInset; |
| if (![homeButton_ isHidden]) { |
| // Ensure proper spacing between the home button and the location bar. |
| - locationBarFrame.origin.x += kMaterialDesignElementPadding; |
| + locationBarFrame.origin.x += kElementPadding; |
| } |
| locationBarFrame.origin.y = NSMaxY(toolbarBounds) - |
| - kMaterialDesignLocationBarPadding - kMaterialDesignLocationBarHeight; |
| + kLocationBarPadding - kLocationBarHeight; |
| locationBarFrame.size.width = |
| menuButtonFrame.origin.x - |
| locationBarFrame.origin.x; |
| - locationBarFrame.size.height = kMaterialDesignLocationBarHeight; |
| + locationBarFrame.size.height = kLocationBarHeight; |
| [locationBar_ setFrame:locationBarFrame]; |
| // Correctly position the extension buttons' container view. |
| NSRect containerFrame = [browserActionsContainerView_ frame]; |
| - containerFrame.size.width += kMaterialDesignButtonInset; |
| + containerFrame.size.width += kButtonInset; |
| containerFrame.origin.y = |
| - locationBarFrame.origin.y + kMaterialDesignContainerYOffset; |
| + locationBarFrame.origin.y + kContainerYOffset; |
| containerFrame.size.height = toolbarButtonSize.height; |
| [browserActionsContainerView_ setFrame:containerFrame]; |
| @@ -737,7 +737,7 @@ - (void)showOptionalHomeButton { |
| // hiding the button, reverse the direction of the movement (to the left). |
| CGFloat moveX = [homeButton_ frame].size.width; |
| // Ensure proper spacing between the home button and the location bar. |
| - moveX += kMaterialDesignElementPadding; |
| + moveX += kElementPadding; |
| if (hide) |
| moveX *= -1; // Reverse the direction of the move. |
| @@ -853,7 +853,7 @@ - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate { |
| locationBarXPos; |
| // Equalize the distance between the location bar and the first extension |
| // button, and the distance between the location bar and home/reload button. |
| - leftDistance -= kMaterialDesignButtonInset; |
| + leftDistance -= kButtonInset; |
| } |
| if (leftDistance != 0.0) |
| [self adjustLocationSizeBy:leftDistance animate:animate]; |
| @@ -885,7 +885,7 @@ - (void)toolbarFrameChanged { |
| [browserActionsContainerView_ stopAnimation]; |
| NSRect containerFrame = [browserActionsContainerView_ frame]; |
| containerFrame.origin.y = |
| - [locationBar_ frame].origin.y + kMaterialDesignContainerYOffset; |
| + [locationBar_ frame].origin.y + kContainerYOffset; |
| [browserActionsContainerView_ setFrame:containerFrame]; |
| [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; |
| } |