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

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

Issue 246433013: Merge 264607 "Fix the remaining subpixel antialiasing bugs in th..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/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
« no previous file with comments | « ui/message_center/cocoa/settings_entry_view.mm ('k') | ui/message_center/message_center.gyp » ('j') | 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/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(
407 [[MCTextField alloc] initWithFrame:NSZeroRect backgroundColor:color]);
414 408
415 [title_ setFont:font]; 409 [title_ setFont:font];
416 [title_ setStringValue: 410 [title_ setStringValue:
417 l10n_util::GetNSString(IDS_MESSAGE_CENTER_FOOTER_TITLE)]; 411 l10n_util::GetNSString(IDS_MESSAGE_CENTER_FOOTER_TITLE)];
418 [title_ setTextColor:gfx::SkColorToCalibratedNSColor( 412 [title_ setTextColor:gfx::SkColorToCalibratedNSColor(
419 message_center::kRegularTextColor)]; 413 message_center::kRegularTextColor)];
420 [title_ sizeToFit]; 414 [title_ sizeToFit];
421 415
422 NSRect titleFrame = [title_ frame]; 416 NSRect titleFrame = [title_ frame];
423 titleFrame.origin.x = message_center::kMarginBetweenItems; 417 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)]; 528 l10n_util::GetNSString(IDS_MESSAGE_CENTER_QUIET_MODE_BUTTON_TOOLTIP)];
535 [[pauseButton_ cell] 529 [[pauseButton_ cell]
536 accessibilitySetOverrideValue:[pauseButton_ toolTip] 530 accessibilitySetOverrideValue:[pauseButton_ toolTip]
537 forAttribute:NSAccessibilityDescriptionAttribute]; 531 forAttribute:NSAccessibilityDescriptionAttribute];
538 [pauseButton_ setAction:@selector(toggleQuietMode:)]; 532 [pauseButton_ setAction:@selector(toggleQuietMode:)];
539 configureButton(pauseButton_); 533 configureButton(pauseButton_);
540 [view addSubview:pauseButton_]; 534 [view addSubview:pauseButton_];
541 535
542 // Create the description field for the empty message center. Initially it is 536 // Create the description field for the empty message center. Initially it is
543 // invisible. 537 // invisible.
544 emptyDescription_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]); 538 emptyDescription_.reset(
545 configureLabel(emptyDescription_); 539 [[MCTextField alloc] initWithFrame:NSZeroRect backgroundColor:color]);
546 540
547 NSFont* smallFont = 541 NSFont* smallFont =
548 [NSFont labelFontOfSize:message_center::kEmptyCenterFontSize]; 542 [NSFont labelFontOfSize:message_center::kEmptyCenterFontSize];
549 [emptyDescription_ setFont:smallFont]; 543 [emptyDescription_ setFont:smallFont];
550 [emptyDescription_ setStringValue: 544 [emptyDescription_ setStringValue:
551 l10n_util::GetNSString(IDS_MESSAGE_CENTER_NO_MESSAGES)]; 545 l10n_util::GetNSString(IDS_MESSAGE_CENTER_NO_MESSAGES)];
552 [emptyDescription_ setTextColor:gfx::SkColorToCalibratedNSColor( 546 [emptyDescription_ setTextColor:gfx::SkColorToCalibratedNSColor(
553 message_center::kDimTextColor)]; 547 message_center::kDimTextColor)];
554 [emptyDescription_ sizeToFit]; 548 [emptyDescription_ sizeToFit];
555 [emptyDescription_ setHidden:YES]; 549 [emptyDescription_ setHidden:YES];
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 [pauseButton_ setDefaultImage: rb.GetNativeImageNamed( 799 [pauseButton_ setDefaultImage: rb.GetNativeImageNamed(
806 IDR_NOTIFICATION_DO_NOT_DISTURB_PRESSED).ToNSImage()]; 800 IDR_NOTIFICATION_DO_NOT_DISTURB_PRESSED).ToNSImage()];
807 } else { 801 } else {
808 [pauseButton_ setTrackingEnabled:YES]; 802 [pauseButton_ setTrackingEnabled:YES];
809 [pauseButton_ setDefaultImage: 803 [pauseButton_ setDefaultImage:
810 rb.GetNativeImageNamed(IDR_NOTIFICATION_DO_NOT_DISTURB).ToNSImage()]; 804 rb.GetNativeImageNamed(IDR_NOTIFICATION_DO_NOT_DISTURB).ToNSImage()];
811 } 805 }
812 } 806 }
813 807
814 @end 808 @end
OLDNEW
« no previous file with comments | « ui/message_center/cocoa/settings_entry_view.mm ('k') | ui/message_center/message_center.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698