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

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

Issue 240703004: Fix the remaining subpixel antialiasing bugs in the notification center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/tray_view_controller.h" 5 #import "ui/message_center/cocoa/tray_view_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/mac/scoped_nsautorelease_pool.h" 9 #include "base/mac/scoped_nsautorelease_pool.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "grit/ui_strings.h" 12 #include "grit/ui_strings.h"
13 #include "skia/ext/skia_utils_mac.h" 13 #include "skia/ext/skia_utils_mac.h"
14 #import "ui/base/cocoa/hover_image_button.h" 14 #import "ui/base/cocoa/hover_image_button.h"
15 #include "ui/base/l10n/l10n_util_mac.h" 15 #include "ui/base/l10n/l10n_util_mac.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 #import "ui/message_center/cocoa/opaque_views.h"
17 #import "ui/message_center/cocoa/notification_controller.h" 18 #import "ui/message_center/cocoa/notification_controller.h"
18 #import "ui/message_center/cocoa/settings_controller.h" 19 #import "ui/message_center/cocoa/settings_controller.h"
19 #include "ui/message_center/message_center.h" 20 #include "ui/message_center/message_center.h"
20 #include "ui/message_center/message_center_style.h" 21 #include "ui/message_center/message_center_style.h"
21 #include "ui/message_center/notifier_settings.h" 22 #include "ui/message_center/notifier_settings.h"
22 23
23 const int kBackButtonSize = 16; 24 const int kBackButtonSize = 16;
24 25
25 // NSClipView subclass. 26 // NSClipView subclass.
26 @interface MCClipView : NSClipView { 27 @interface MCClipView : NSClipView {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 (message_center::TrayAnimationEndedCallback)callback { 392 (message_center::TrayAnimationEndedCallback)callback {
392 testingAnimationEndedCallback_.reset(Block_copy(callback)); 393 testingAnimationEndedCallback_.reset(Block_copy(callback));
393 } 394 }
394 395
395 // Private ///////////////////////////////////////////////////////////////////// 396 // Private /////////////////////////////////////////////////////////////////////
396 397
397 - (void)layoutControlArea { 398 - (void)layoutControlArea {
398 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 399 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
399 NSView* view = [self view]; 400 NSView* view = [self view];
400 401
401 auto configureLabel = ^(NSTextField* textField) {
402 [textField setAutoresizingMask:NSViewMinYMargin];
403 [textField setBezeled:NO];
404 [textField setBordered:NO];
405 [textField setDrawsBackground:NO];
406 [textField setEditable:NO];
407 [textField setSelectable:NO];
408 };
409
410 // Create the "Notifications" label at the top of the tray. 402 // Create the "Notifications" label at the top of the tray.
411 NSFont* font = [NSFont labelFontOfSize:message_center::kTitleFontSize]; 403 NSFont* font = [NSFont labelFontOfSize:message_center::kTitleFontSize];
412 title_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]); 404 NSColor* color = gfx::SkColorToCalibratedNSColor(
413 configureLabel(title_); 405 message_center::kMessageCenterBackgroundColor);
406 title_.reset([[MCTextField alloc] initWithFrame:NSZeroRect andColor:color]);
414 407
415 [title_ setFont:font]; 408 [title_ setFont:font];
416 [title_ setStringValue: 409 [title_ setStringValue:
417 l10n_util::GetNSString(IDS_MESSAGE_CENTER_FOOTER_TITLE)]; 410 l10n_util::GetNSString(IDS_MESSAGE_CENTER_FOOTER_TITLE)];
418 [title_ setTextColor:gfx::SkColorToCalibratedNSColor( 411 [title_ setTextColor:gfx::SkColorToCalibratedNSColor(
419 message_center::kRegularTextColor)]; 412 message_center::kRegularTextColor)];
420 [title_ sizeToFit]; 413 [title_ sizeToFit];
421 414
422 NSRect titleFrame = [title_ frame]; 415 NSRect titleFrame = [title_ frame];
423 titleFrame.origin.x = message_center::kMarginBetweenItems; 416 titleFrame.origin.x = message_center::kMarginBetweenItems;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 l10n_util::GetNSString(IDS_MESSAGE_CENTER_QUIET_MODE_BUTTON_TOOLTIP)]; 527 l10n_util::GetNSString(IDS_MESSAGE_CENTER_QUIET_MODE_BUTTON_TOOLTIP)];
535 [[pauseButton_ cell] 528 [[pauseButton_ cell]
536 accessibilitySetOverrideValue:[pauseButton_ toolTip] 529 accessibilitySetOverrideValue:[pauseButton_ toolTip]
537 forAttribute:NSAccessibilityDescriptionAttribute]; 530 forAttribute:NSAccessibilityDescriptionAttribute];
538 [pauseButton_ setAction:@selector(toggleQuietMode:)]; 531 [pauseButton_ setAction:@selector(toggleQuietMode:)];
539 configureButton(pauseButton_); 532 configureButton(pauseButton_);
540 [view addSubview:pauseButton_]; 533 [view addSubview:pauseButton_];
541 534
542 // Create the description field for the empty message center. Initially it is 535 // Create the description field for the empty message center. Initially it is
543 // invisible. 536 // invisible.
544 emptyDescription_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]); 537 emptyDescription_.reset(
545 configureLabel(emptyDescription_); 538 [[MCTextField alloc] initWithFrame:NSZeroRect andColor:color]);
546 539
547 NSFont* smallFont = 540 NSFont* smallFont =
548 [NSFont labelFontOfSize:message_center::kEmptyCenterFontSize]; 541 [NSFont labelFontOfSize:message_center::kEmptyCenterFontSize];
549 [emptyDescription_ setFont:smallFont]; 542 [emptyDescription_ setFont:smallFont];
550 [emptyDescription_ setStringValue: 543 [emptyDescription_ setStringValue:
551 l10n_util::GetNSString(IDS_MESSAGE_CENTER_NO_MESSAGES)]; 544 l10n_util::GetNSString(IDS_MESSAGE_CENTER_NO_MESSAGES)];
552 [emptyDescription_ setTextColor:gfx::SkColorToCalibratedNSColor( 545 [emptyDescription_ setTextColor:gfx::SkColorToCalibratedNSColor(
553 message_center::kDimTextColor)]; 546 message_center::kDimTextColor)];
554 [emptyDescription_ sizeToFit]; 547 [emptyDescription_ sizeToFit];
555 [emptyDescription_ setHidden:YES]; 548 [emptyDescription_ setHidden:YES];
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 [pauseButton_ setDefaultImage: rb.GetNativeImageNamed( 798 [pauseButton_ setDefaultImage: rb.GetNativeImageNamed(
806 IDR_NOTIFICATION_DO_NOT_DISTURB_PRESSED).ToNSImage()]; 799 IDR_NOTIFICATION_DO_NOT_DISTURB_PRESSED).ToNSImage()];
807 } else { 800 } else {
808 [pauseButton_ setTrackingEnabled:YES]; 801 [pauseButton_ setTrackingEnabled:YES];
809 [pauseButton_ setDefaultImage: 802 [pauseButton_ setDefaultImage:
810 rb.GetNativeImageNamed(IDR_NOTIFICATION_DO_NOT_DISTURB).ToNSImage()]; 803 rb.GetNativeImageNamed(IDR_NOTIFICATION_DO_NOT_DISTURB).ToNSImage()];
811 } 804 }
812 } 805 }
813 806
814 @end 807 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698