| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dock_icon.h" | 5 #import "chrome/browser/ui/cocoa/dock_icon.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/memory/scoped_nsobject.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 [appIcon drawInRect:[self bounds] | 59 [appIcon drawInRect:[self bounds] |
| 60 fromRect:NSZeroRect | 60 fromRect:NSZeroRect |
| 61 operation:NSCompositeSourceOver | 61 operation:NSCompositeSourceOver |
| 62 fraction:1.0]; | 62 fraction:1.0]; |
| 63 | 63 |
| 64 if (downloads_ == 0) | 64 if (downloads_ == 0) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 NSRect badgeRect = [self bounds]; | 67 NSRect badgeRect = [self bounds]; |
| 68 badgeRect.size.height = (int)(kBadgeFraction * badgeRect.size.height); | 68 badgeRect.size.height = (int)(kBadgeFraction * badgeRect.size.height); |
| 69 int newWidth = kBadgeFraction * badgeRect.size.width; | 69 int newWidth = kBadgeFraction * NSWidth(badgeRect); |
| 70 badgeRect.origin.x = badgeRect.size.width - newWidth; | 70 badgeRect.origin.x = NSWidth(badgeRect) - newWidth; |
| 71 badgeRect.size.width = newWidth; | 71 badgeRect.size.width = newWidth; |
| 72 | 72 |
| 73 CGFloat badgeRadius = NSMidY(badgeRect); | 73 CGFloat badgeRadius = NSMidY(badgeRect); |
| 74 | 74 |
| 75 badgeRect.origin.x -= kBadgeIndent; | 75 badgeRect.origin.x -= kBadgeIndent; |
| 76 badgeRect.origin.y += kBadgeIndent; | 76 badgeRect.origin.y += kBadgeIndent; |
| 77 | 77 |
| 78 NSPoint badgeCenter = NSMakePoint(NSMidX(badgeRect), | 78 NSPoint badgeCenter = NSMakePoint(NSMidX(badgeRect), NSMidY(badgeRect)); |
| 79 NSMidY(badgeRect)); | |
| 80 | 79 |
| 81 // Background | 80 // Background |
| 82 NSColor* backgroundColor = [NSColor colorWithCalibratedRed:0.85 | 81 NSColor* backgroundColor = [NSColor colorWithCalibratedRed:0.85 |
| 83 green:0.85 | 82 green:0.85 |
| 84 blue:0.85 | 83 blue:0.85 |
| 85 alpha:1.0]; | 84 alpha:1.0]; |
| 86 NSColor* backgroundHighlight = | 85 NSColor* backgroundHighlight = |
| 87 [backgroundColor blendedColorWithFraction:0.85 | 86 [backgroundColor blendedColorWithFraction:0.85 |
| 88 ofColor:[NSColor whiteColor]]; | 87 ofColor:[NSColor whiteColor]]; |
| 89 scoped_nsobject<NSGradient> backgroundGradient( | 88 scoped_nsobject<NSGradient> backgroundGradient( |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 258 |
| 260 - (void)setProgress:(float)progress { | 259 - (void)setProgress:(float)progress { |
| 261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 262 NSDockTile* dockTile = [[NSApplication sharedApplication] dockTile]; | 261 NSDockTile* dockTile = [[NSApplication sharedApplication] dockTile]; |
| 263 DockTileView* dockTileView = (DockTileView*)([dockTile contentView]); | 262 DockTileView* dockTileView = (DockTileView*)([dockTile contentView]); |
| 264 | 263 |
| 265 [dockTileView setProgress:progress]; | 264 [dockTileView setProgress:progress]; |
| 266 } | 265 } |
| 267 | 266 |
| 268 @end | 267 @end |
| OLD | NEW |