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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 1876293002: [Mac][Material Design] Center elements within the toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extension_button_rework
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 // Set the toolbar height. 302 // Set the toolbar height.
303 NSRect frame = [toolbarView frame]; 303 NSRect frame = [toolbarView frame];
304 frame.size.height = [self baseToolbarHeight]; 304 frame.size.height = [self baseToolbarHeight];
305 [toolbarView setFrame:frame]; 305 [toolbarView setFrame:frame];
306 306
307 NSRect backButtonFrame = [backButton_ frame]; 307 NSRect backButtonFrame = [backButton_ frame];
308 backButtonFrame.origin.x = 308 backButtonFrame.origin.x =
309 kMaterialDesignElementPadding + kMaterialDesignButtonInset; 309 kMaterialDesignElementPadding + kMaterialDesignButtonInset;
310 backButtonFrame.origin.y = NSMaxY(toolbarBounds) - 310 backButtonFrame.origin.y = NSMaxY(toolbarBounds) -
311 kMaterialDesignElementPadding - kMaterialDesignButtonInset - 311 kMaterialDesignElementPadding - toolbarButtonSize.height;
312 toolbarButtonSize.height;
313 backButtonFrame.size = toolbarButtonSize; 312 backButtonFrame.size = toolbarButtonSize;
314 [backButton_ setFrame:backButtonFrame]; 313 [backButton_ setFrame:backButtonFrame];
315 314
316 NSRect forwardButtonFrame = [forwardButton_ frame]; 315 NSRect forwardButtonFrame = [forwardButton_ frame];
317 forwardButtonFrame.origin.x = 316 forwardButtonFrame.origin.x =
318 NSMaxX(backButtonFrame) + 2 * kMaterialDesignButtonInset; 317 NSMaxX(backButtonFrame) + 2 * kMaterialDesignButtonInset;
319 forwardButtonFrame.origin.y = backButtonFrame.origin.y; 318 forwardButtonFrame.origin.y = backButtonFrame.origin.y;
320 forwardButtonFrame.size = toolbarButtonSize; 319 forwardButtonFrame.size = toolbarButtonSize;
321 [forwardButton_ setFrame:forwardButtonFrame]; 320 [forwardButton_ setFrame:forwardButtonFrame];
322 321
(...skipping 30 matching lines...) Expand all
353 toolbarButtonSize.width; 352 toolbarButtonSize.width;
354 menuButtonFrame.origin.y = homeButtonFrame.origin.y; 353 menuButtonFrame.origin.y = homeButtonFrame.origin.y;
355 menuButtonFrame.size = toolbarButtonSize; 354 menuButtonFrame.size = toolbarButtonSize;
356 [appMenuButton_ setFrame:menuButtonFrame]; 355 [appMenuButton_ setFrame:menuButtonFrame];
357 356
358 // Adjust the size and location on the location bar to take up the 357 // Adjust the size and location on the location bar to take up the
359 // space between the reload and menu buttons. 358 // space between the reload and menu buttons.
360 NSRect locationBarFrame = [locationBar_ frame]; 359 NSRect locationBarFrame = [locationBar_ frame];
361 locationBarFrame.origin.x = NSMaxX(homeButtonFrame) + 360 locationBarFrame.origin.x = NSMaxX(homeButtonFrame) +
362 kMaterialDesignButtonInset; 361 kMaterialDesignButtonInset;
363 locationBarFrame.origin.y = NSMaxY(toolbarBounds) - 362 locationBarFrame.origin.y = NSMaxY(toolbarBounds) - 2 -
Avi (use Gerrit) 2016/04/11 21:32:06 Is this "2" related to a constant somehow? An inse
364 kMaterialDesignElementPadding - kMaterialDesignLocationBarHeight; 363 kMaterialDesignLocationBarHeight;
365 locationBarFrame.size.width = 364 locationBarFrame.size.width =
366 menuButtonFrame.origin.x - 365 menuButtonFrame.origin.x -
367 locationBarFrame.origin.x; 366 locationBarFrame.origin.x;
368 locationBarFrame.size.height = kMaterialDesignLocationBarHeight; 367 locationBarFrame.size.height = kMaterialDesignLocationBarHeight;
369 [locationBar_ setFrame:locationBarFrame]; 368 [locationBar_ setFrame:locationBarFrame];
370 369
371 // Correctly position the extension buttons' container view. 370 // Correctly position the extension buttons' container view.
372 NSRect containerFrame = [browserActionsContainerView_ frame]; 371 NSRect containerFrame = [browserActionsContainerView_ frame];
373 containerFrame.size.width += kMaterialDesignButtonInset; 372 containerFrame.size.width += kMaterialDesignButtonInset;
374 containerFrame.origin.y = 373 containerFrame.origin.y =
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1151 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1153 // Do nothing. 1152 // Do nothing.
1154 } 1153 }
1155 1154
1156 // (URLDropTargetController protocol) 1155 // (URLDropTargetController protocol)
1157 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1156 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1158 return drag_util::IsUnsupportedDropData(profile_, info); 1157 return drag_util::IsUnsupportedDropData(profile_, info);
1159 } 1158 }
1160 1159
1161 @end 1160 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698