| 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/download/download_item_cell.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "chrome/browser/download/download_item_model.h" | 8 #include "chrome/browser/download/download_item_model.h" |
| 9 #include "chrome/browser/download/download_shelf.h" | 9 #include "chrome/browser/download/download_shelf.h" |
| 10 #import "chrome/browser/themes/theme_properties.h" | 10 #import "chrome/browser/themes/theme_properties.h" |
| 11 #import "chrome/browser/ui/cocoa/download/background_theme.h" | 11 #import "chrome/browser/ui/cocoa/download/background_theme.h" |
| 12 #import "chrome/browser/ui/cocoa/themed_window.h" | 12 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 13 #include "content/public/browser/download_item.h" | 13 #include "content/public/browser/download_item.h" |
| 14 #include "content/public/browser/download_manager.h" | 14 #include "content/public/browser/download_manager.h" |
| 15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 16 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 16 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
| 17 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" | 17 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/text/text_elider.h" | 19 #include "ui/gfx/text_elider.h" |
| 20 #include "ui/gfx/canvas_skia_paint.h" | 20 #include "ui/gfx/canvas_skia_paint.h" |
| 21 #include "ui/gfx/font.h" | 21 #include "ui/gfx/font.h" |
| 22 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 22 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 23 | 23 |
| 24 // Distance from top border to icon. | 24 // Distance from top border to icon. |
| 25 const CGFloat kImagePaddingTop = 7; | 25 const CGFloat kImagePaddingTop = 7; |
| 26 | 26 |
| 27 // Distance from left border to icon. | 27 // Distance from left border to icon. |
| 28 const CGFloat kImagePaddingLeft = 9; | 28 const CGFloat kImagePaddingLeft = 9; |
| 29 | 29 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 [path lineToPoint:topLeft]; | 371 [path lineToPoint:topLeft]; |
| 372 return path; | 372 return path; |
| 373 } | 373 } |
| 374 | 374 |
| 375 - (NSString*)elideTitle:(int)availableWidth { | 375 - (NSString*)elideTitle:(int)availableWidth { |
| 376 NSFont* font = [self font]; | 376 NSFont* font = [self font]; |
| 377 gfx::Font font_chr(base::SysNSStringToUTF8([font fontName]), | 377 gfx::Font font_chr(base::SysNSStringToUTF8([font fontName]), |
| 378 [font pointSize]); | 378 [font pointSize]); |
| 379 | 379 |
| 380 return base::SysUTF16ToNSString( | 380 return base::SysUTF16ToNSString( |
| 381 ui::ElideFilename(downloadPath_, font_chr, availableWidth)); | 381 gfx::ElideFilename(downloadPath_, font_chr, availableWidth)); |
| 382 } | 382 } |
| 383 | 383 |
| 384 - (NSString*)elideStatus:(int)availableWidth { | 384 - (NSString*)elideStatus:(int)availableWidth { |
| 385 NSFont* font = [self secondaryFont]; | 385 NSFont* font = [self secondaryFont]; |
| 386 gfx::Font font_chr(base::SysNSStringToUTF8([font fontName]), | 386 gfx::Font font_chr(base::SysNSStringToUTF8([font fontName]), |
| 387 [font pointSize]); | 387 [font pointSize]); |
| 388 | 388 |
| 389 return base::SysUTF16ToNSString(ui::ElideText( | 389 return base::SysUTF16ToNSString(gfx::ElideText( |
| 390 base::SysNSStringToUTF16([self secondaryTitle]), | 390 base::SysNSStringToUTF16([self secondaryTitle]), |
| 391 font_chr, | 391 font_chr, |
| 392 availableWidth, | 392 availableWidth, |
| 393 ui::ELIDE_AT_END)); | 393 gfx::ELIDE_AT_END)); |
| 394 } | 394 } |
| 395 | 395 |
| 396 - (ui::ThemeProvider*)backgroundThemeWrappingProvider: | 396 - (ui::ThemeProvider*)backgroundThemeWrappingProvider: |
| 397 (ui::ThemeProvider*)provider { | 397 (ui::ThemeProvider*)provider { |
| 398 if (!themeProvider_.get()) { | 398 if (!themeProvider_.get()) { |
| 399 themeProvider_.reset(new BackgroundTheme(provider)); | 399 themeProvider_.reset(new BackgroundTheme(provider)); |
| 400 } | 400 } |
| 401 | 401 |
| 402 return themeProvider_.get(); | 402 return themeProvider_.get(); |
| 403 } | 403 } |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 | 770 |
| 771 - (void)invalidate { | 771 - (void)invalidate { |
| 772 [timer_ invalidate]; | 772 [timer_ invalidate]; |
| 773 } | 773 } |
| 774 | 774 |
| 775 - (void)onTimer:(NSTimer*)timer { | 775 - (void)onTimer:(NSTimer*)timer { |
| 776 [cell_ updateIndeterminateDownload]; | 776 [cell_ updateIndeterminateDownload]; |
| 777 } | 777 } |
| 778 | 778 |
| 779 @end | 779 @end |
| OLD | NEW |