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

Side by Side Diff: ui/message_center/cocoa/notification_controller.mm

Issue 1487373003: Reposition the settings button as part of the notification update method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove nil checks Created 5 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/message_center/cocoa/notification_controller.h" 5 #import "ui/message_center/cocoa/notification_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } else { 450 } else {
451 message = notification->context_message(); 451 message = notification->context_message();
452 } 452 }
453 453
454 base::string16 elided = 454 base::string16 elided =
455 [self wrapText:message 455 [self wrapText:message
456 forFont:[contextMessage_ font] 456 forFont:[contextMessage_ font]
457 maxNumberOfLines:message_center::kContextMessageLineLimit]; 457 maxNumberOfLines:message_center::kContextMessageLineLimit];
458 [contextMessage_ setString:base::SysUTF16ToNSString(elided)]; 458 [contextMessage_ setString:base::SysUTF16ToNSString(elided)];
459 [contextMessage_ sizeToFit]; 459 [contextMessage_ sizeToFit];
460
dewittj 2015/12/02 17:08:24 nit: any reason to add this line?
Miguel Garcia 2015/12/02 17:29:37 no reason, removed now
460 NSRect contextMessageFrame = [contextMessage_ frame]; 461 NSRect contextMessageFrame = [contextMessage_ frame];
461 462
462 if (notification->context_message().empty() && 463 if (notification->context_message().empty() &&
463 !notification->UseOriginAsContextMessage()) { 464 !notification->UseOriginAsContextMessage()) {
464 [contextMessage_ setHidden:YES]; 465 [contextMessage_ setHidden:YES];
465 contextMessageFrame.origin.y = messageFrame.origin.y; 466 contextMessageFrame.origin.y = messageFrame.origin.y;
466 contextMessageFrame.size.height = 0; 467 contextMessageFrame.size.height = 0;
467 } else { 468 } else {
468 [contextMessage_ setHidden:NO]; 469 [contextMessage_ setHidden:NO];
469 contextMessageFrame.origin.y = 470 contextMessageFrame.origin.y =
470 NSMinY(messageFrame) - 471 NSMinY(messageFrame) -
471 contextMessagePadding - 472 contextMessagePadding -
472 NSHeight(contextMessageFrame); 473 NSHeight(contextMessageFrame);
473 contextMessageFrame.size.height = NSHeight([contextMessage_ frame]); 474 contextMessageFrame.size.height = NSHeight([contextMessage_ frame]);
474 } 475 }
475 476
477 NSRect settingsButtonFrame = [settingsButton_ frame];
478
476 // Create the list item views (up to a maximum). 479 // Create the list item views (up to a maximum).
477 [listView_ removeFromSuperview]; 480 [listView_ removeFromSuperview];
478 NSRect listFrame = NSZeroRect; 481 NSRect listFrame = NSZeroRect;
479 if (items.size() > 0) { 482 if (items.size() > 0) {
480 listFrame = [self currentContentRect]; 483 listFrame = [self currentContentRect];
481 listFrame.origin.y = 0; 484 listFrame.origin.y = 0;
482 listFrame.size.height = 0; 485 listFrame.size.height = 0;
483 listView_.reset([[NSView alloc] initWithFrame:listFrame]); 486 listView_.reset([[NSView alloc] initWithFrame:listFrame]);
484 [listView_ accessibilitySetOverrideValue:NSAccessibilityListRole 487 [listView_ accessibilitySetOverrideValue:NSAccessibilityListRole
485 forAttribute:NSAccessibilityRoleAttribute]; 488 forAttribute:NSAccessibilityRoleAttribute];
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 messageFrame.origin.y += bottomAdjust; 657 messageFrame.origin.y += bottomAdjust;
655 contextMessageFrame.origin.y += bottomAdjust; 658 contextMessageFrame.origin.y += bottomAdjust;
656 listFrame.origin.y += bottomAdjust; 659 listFrame.origin.y += bottomAdjust;
657 progressBarFrame.origin.y += bottomAdjust; 660 progressBarFrame.origin.y += bottomAdjust;
658 } 661 }
659 662
660 [[self view] setFrame:rootFrame]; 663 [[self view] setFrame:rootFrame];
661 [title_ setFrame:titleFrame]; 664 [title_ setFrame:titleFrame];
662 [message_ setFrame:messageFrame]; 665 [message_ setFrame:messageFrame];
663 [contextMessage_ setFrame:contextMessageFrame]; 666 [contextMessage_ setFrame:contextMessageFrame];
667 [settingsButton_ setFrame:settingsButtonFrame];
664 [listView_ setFrame:listFrame]; 668 [listView_ setFrame:listFrame];
665 [progressBarView_ setFrame:progressBarFrame]; 669 [progressBarView_ setFrame:progressBarFrame];
666 670
667 return rootFrame; 671 return rootFrame;
668 } 672 }
669 673
670 - (void)close:(id)sender { 674 - (void)close:(id)sender {
671 [closeButton_ setTarget:nil]; 675 [closeButton_ setTarget:nil];
672 messageCenter_->RemoveNotification([self notificationID], /*by_user=*/true); 676 messageCenter_->RemoveNotification([self notificationID], /*by_user=*/true);
673 } 677 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 forFont:(NSFont*)nsfont 961 forFont:(NSFont*)nsfont
958 maxNumberOfLines:(size_t)lines { 962 maxNumberOfLines:(size_t)lines {
959 size_t unused; 963 size_t unused;
960 return [self wrapText:text 964 return [self wrapText:text
961 forFont:nsfont 965 forFont:nsfont
962 maxNumberOfLines:lines 966 maxNumberOfLines:lines
963 actualLines:&unused]; 967 actualLines:&unused];
964 } 968 }
965 969
966 @end 970 @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