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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.mm

Issue 2555553002: Fix learn more button positioning (Closed)
Patch Set: Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extensions/toolbar_actions_bar_bubble_mac.h" 5 #import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 currentMaxWidth -= (actionButtonSize.width + kButtonPadding); 311 currentMaxWidth -= (actionButtonSize.width + kButtonPadding);
312 } 312 }
313 if (dismissButton_) { 313 if (dismissButton_) {
314 [dismissButton_ setFrame:NSMakeRect( 314 [dismissButton_ setFrame:NSMakeRect(
315 currentMaxWidth - dismissButtonSize.width, 315 currentMaxWidth - dismissButtonSize.width,
316 currentHeight, 316 currentHeight,
317 dismissButtonSize.width, 317 dismissButtonSize.width,
318 dismissButtonSize.height)]; 318 dismissButtonSize.height)];
319 currentMaxWidth -= (dismissButtonSize.width + kButtonPadding); 319 currentMaxWidth -= (dismissButtonSize.width + kButtonPadding);
320 } 320 }
321 int leftAlignXPos = kHorizontalPadding;
322 if (iconView_) {
323 CGFloat extraViewIconHeight =
324 currentHeight + (buttonStripHeight - extraViewIconSize.height) / 2.0;
325
326 [iconView_
327 setFrame:NSMakeRect(leftAlignXPos, extraViewIconHeight,
328 extraViewIconSize.width, extraViewIconSize.height)];
329 leftAlignXPos += extraViewIconSize.width + kButtonPadding;
330 }
321 if (label_ || link_) { 331 if (label_ || link_) {
322 CGFloat extraViewTextHeight = 332 CGFloat extraViewTextHeight =
323 currentHeight + (buttonStripHeight - extraViewTextSize.height) / 2.0; 333 currentHeight + (buttonStripHeight - extraViewTextSize.height) / 2.0;
324 NSRect frame = NSMakeRect(currentMaxWidth - extraViewTextSize.width, 334 NSRect frame =
325 extraViewTextHeight, extraViewTextSize.width, 335 NSMakeRect(leftAlignXPos, extraViewTextHeight, extraViewTextSize.width,
326 extraViewTextSize.height); 336 extraViewTextSize.height);
327 if (link_) { 337 if (link_) {
328 [link_ setFrame:frame]; 338 [link_ setFrame:frame];
329 } else { 339 } else {
330 [label_ setFrame:frame]; 340 [label_ setFrame:frame];
331 } 341 }
332 currentMaxWidth -= extraViewTextSize.width + kButtonPadding;
333 }
334 if (iconView_) {
335 CGFloat extraViewIconHeight =
336 currentHeight + (buttonStripHeight - extraViewIconSize.height) / 2.0;
337
338 [iconView_
339 setFrame:NSMakeRect(kHorizontalPadding, extraViewIconHeight,
340 extraViewIconSize.width, extraViewIconSize.height)];
341 currentMaxWidth -= extraViewIconSize.width + kButtonPadding;
342 } 342 }
343 // Buttons have some inherit padding of their own, so we don't need quite as 343 // Buttons have some inherit padding of their own, so we don't need quite as
344 // much space here. 344 // much space here.
345 currentHeight += buttonStripHeight + kVerticalPadding / 2; 345 currentHeight += buttonStripHeight + kVerticalPadding / 2;
346 346
347 if (itemList_) { 347 if (itemList_) {
348 [itemList_ setFrame:NSMakeRect(kHorizontalPadding + kItemListIndentation, 348 [itemList_ setFrame:NSMakeRect(kHorizontalPadding + kItemListIndentation,
349 currentHeight, 349 currentHeight,
350 itemListSize.width, 350 itemListSize.width,
351 itemListSize.height)]; 351 itemListSize.height)];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } else { 388 } else {
389 DCHECK_EQ(sender, actionButton_); 389 DCHECK_EQ(sender, actionButton_);
390 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; 390 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE;
391 } 391 }
392 acknowledged_ = YES; 392 acknowledged_ = YES;
393 delegate_->OnBubbleClosed(action); 393 delegate_->OnBubbleClosed(action);
394 [self close]; 394 [self close];
395 } 395 }
396 396
397 @end 397 @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