| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/text_elider.h" | |
| 9 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/download/download_item.h" | 9 #include "chrome/browser/download/download_item.h" |
| 11 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| 12 #include "chrome/browser/download/download_manager.h" | 11 #include "chrome/browser/download/download_manager.h" |
| 13 #include "chrome/browser/download/download_util.h" | 12 #include "chrome/browser/download/download_util.h" |
| 14 #import "chrome/browser/themes/browser_theme_provider.h" | 13 #import "chrome/browser/themes/browser_theme_provider.h" |
| 15 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" | 14 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" |
| 16 #import "chrome/browser/ui/cocoa/image_utils.h" | 15 #import "chrome/browser/ui/cocoa/image_utils.h" |
| 17 #import "chrome/browser/ui/cocoa/themed_window.h" | 16 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 18 #include "gfx/canvas_skia_paint.h" | 17 #include "gfx/canvas_skia_paint.h" |
| 19 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 20 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 19 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
| 21 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" | 20 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" |
| 21 #include "ui/base/text/text_elider.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Distance from top border to icon | 25 // Distance from top border to icon |
| 26 const CGFloat kImagePaddingTop = 7; | 26 const CGFloat kImagePaddingTop = 7; |
| 27 | 27 |
| 28 // Distance from left border to icon | 28 // Distance from left border to icon |
| 29 const CGFloat kImagePaddingLeft = 9; | 29 const CGFloat kImagePaddingLeft = 9; |
| 30 | 30 |
| 31 // Width of icon | 31 // Width of icon |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 [path lineToPoint:topLeft]; | 391 [path lineToPoint:topLeft]; |
| 392 return path; | 392 return path; |
| 393 } | 393 } |
| 394 | 394 |
| 395 - (NSString*)elideTitle:(int)availableWidth { | 395 - (NSString*)elideTitle:(int)availableWidth { |
| 396 NSFont* font = [self font]; | 396 NSFont* font = [self font]; |
| 397 gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]), | 397 gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]), |
| 398 [font pointSize]); | 398 [font pointSize]); |
| 399 | 399 |
| 400 return base::SysUTF16ToNSString( | 400 return base::SysUTF16ToNSString( |
| 401 ElideFilename(downloadPath_, font_chr, availableWidth)); | 401 ui::ElideFilename(downloadPath_, font_chr, availableWidth)); |
| 402 } | 402 } |
| 403 | 403 |
| 404 - (NSString*)elideStatus:(int)availableWidth { | 404 - (NSString*)elideStatus:(int)availableWidth { |
| 405 NSFont* font = [self secondaryFont]; | 405 NSFont* font = [self secondaryFont]; |
| 406 gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]), | 406 gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]), |
| 407 [font pointSize]); | 407 [font pointSize]); |
| 408 | 408 |
| 409 return base::SysUTF16ToNSString(ElideText( | 409 return base::SysUTF16ToNSString(ui::ElideText( |
| 410 base::SysNSStringToUTF16([self secondaryTitle]), | 410 base::SysNSStringToUTF16([self secondaryTitle]), |
| 411 font_chr, | 411 font_chr, |
| 412 availableWidth, | 412 availableWidth, |
| 413 false)); | 413 false)); |
| 414 } | 414 } |
| 415 | 415 |
| 416 - (ThemeProvider*)backgroundThemeWrappingProvider:(ThemeProvider*)provider { | 416 - (ThemeProvider*)backgroundThemeWrappingProvider:(ThemeProvider*)provider { |
| 417 if (!themeProvider_.get()) { | 417 if (!themeProvider_.get()) { |
| 418 themeProvider_.reset(new BackgroundTheme(provider)); | 418 themeProvider_.reset(new BackgroundTheme(provider)); |
| 419 } | 419 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 698 } |
| 699 return self; | 699 return self; |
| 700 } | 700 } |
| 701 | 701 |
| 702 - (void)setCurrentProgress:(NSAnimationProgress)progress { | 702 - (void)setCurrentProgress:(NSAnimationProgress)progress { |
| 703 [super setCurrentProgress:progress]; | 703 [super setCurrentProgress:progress]; |
| 704 [cell_ animation:self progressed:progress]; | 704 [cell_ animation:self progressed:progress]; |
| 705 } | 705 } |
| 706 | 706 |
| 707 @end | 707 @end |
| OLD | NEW |