OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/download/download_item_cell.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "chrome/browser/download/download_item.h" | 8 #include "chrome/browser/download/download_item.h" |
9 #include "chrome/browser/download/download_item_model.h" | 9 #include "chrome/browser/download/download_item_model.h" |
10 #include "chrome/browser/download/download_manager.h" | 10 #include "chrome/browser/download/download_manager.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 if (![secondaryColor gtm_isDarkColor]) | 399 if (![secondaryColor gtm_isDarkColor]) |
400 secondaryColor = [secondaryColor gtm_colorByAdjustingLuminance:-0.2]; | 400 secondaryColor = [secondaryColor gtm_colorByAdjustingLuminance:-0.2]; |
401 | 401 |
402 NSDictionary* secondaryTextAttributes = | 402 NSDictionary* secondaryTextAttributes = |
403 [NSDictionary dictionaryWithObjectsAndKeys: | 403 [NSDictionary dictionaryWithObjectsAndKeys: |
404 secondaryColor, NSForegroundColorAttributeName, | 404 secondaryColor, NSForegroundColorAttributeName, |
405 [self secondaryFont], NSFontAttributeName, | 405 [self secondaryFont], NSFontAttributeName, |
406 nil]; | 406 nil]; |
407 NSPoint secondaryPos = | 407 NSPoint secondaryPos = |
408 NSMakePoint(innerFrame.origin.x + kTextPosLeft, kSecondaryTextPosTop); | 408 NSMakePoint(innerFrame.origin.x + kTextPosLeft, kSecondaryTextPosTop); |
| 409 NSGraphicsContext* nsContext = [NSGraphicsContext currentContext]; |
| 410 CGContextRef cgContext = (CGContextRef)[nsContext graphicsPort]; |
| 411 [nsContext saveGraphicsState]; |
| 412 [nsContext setCompositingOperation:NSCompositeSourceOver]; |
| 413 CGContextSetAlpha(cgContext, statusAlpha_); |
409 [secondaryText drawAtPoint:secondaryPos | 414 [secondaryText drawAtPoint:secondaryPos |
410 withAttributes:secondaryTextAttributes]; | 415 withAttributes:secondaryTextAttributes]; |
| 416 [nsContext restoreGraphicsState]; |
411 } | 417 } |
412 | 418 |
413 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 419 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
414 NSRect drawFrame = NSInsetRect(cellFrame, 1.5, 1.5); | 420 NSRect drawFrame = NSInsetRect(cellFrame, 1.5, 1.5); |
415 NSRect innerFrame = NSInsetRect(cellFrame, 2, 2); | 421 NSRect innerFrame = NSInsetRect(cellFrame, 2, 2); |
416 | 422 |
417 const float radius = 5; | 423 const float radius = 5; |
418 NSWindow* window = [controlView window]; | 424 NSWindow* window = [controlView window]; |
419 BOOL active = [window isKeyWindow] || [window isMainWindow]; | 425 BOOL active = [window isKeyWindow] || [window isMainWindow]; |
420 | 426 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 } | 685 } |
680 return self; | 686 return self; |
681 } | 687 } |
682 | 688 |
683 - (void)setCurrentProgress:(NSAnimationProgress)progress { | 689 - (void)setCurrentProgress:(NSAnimationProgress)progress { |
684 [super setCurrentProgress:progress]; | 690 [super setCurrentProgress:progress]; |
685 [cell_ animation:self progressed:progress]; | 691 [cell_ animation:self progressed:progress]; |
686 } | 692 } |
687 | 693 |
688 @end | 694 @end |
OLD | NEW |