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 #include "chrome/browser/ui/views/download_item_view.h" | 5 #include "chrome/browser/ui/views/download_item_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 // If text is light-on-dark, lightening it alone will do nothing. | 508 // If text is light-on-dark, lightening it alone will do nothing. |
509 // Therefore we mute luminance a wee bit before drawing in this case. | 509 // Therefore we mute luminance a wee bit before drawing in this case. |
510 if (color_utils::RelativeLuminance(file_name_color) > 0.5) | 510 if (color_utils::RelativeLuminance(file_name_color) > 0.5) |
511 file_name_color = SkColorSetRGB( | 511 file_name_color = SkColorSetRGB( |
512 static_cast<int>(kDownloadItemLuminanceMod * | 512 static_cast<int>(kDownloadItemLuminanceMod * |
513 SkColorGetR(file_name_color)), | 513 SkColorGetR(file_name_color)), |
514 static_cast<int>(kDownloadItemLuminanceMod * | 514 static_cast<int>(kDownloadItemLuminanceMod * |
515 SkColorGetG(file_name_color)), | 515 SkColorGetG(file_name_color)), |
516 static_cast<int>(kDownloadItemLuminanceMod * | 516 static_cast<int>(kDownloadItemLuminanceMod * |
517 SkColorGetB(file_name_color))); | 517 SkColorGetB(file_name_color))); |
518 canvas->DrawStringInt(status_text_, font_, file_name_color, | 518 canvas->DrawStringInt(WideToUTF16Hack(status_text_), font_, |
519 mirrored_x, y, kTextWidth, font_.GetHeight()); | 519 file_name_color, mirrored_x, y, kTextWidth, |
| 520 font_.GetHeight()); |
520 } | 521 } |
521 } | 522 } |
522 | 523 |
523 // Paint the background images. | 524 // Paint the background images. |
524 int x = kLeftPadding; | 525 int x = kLeftPadding; |
525 canvas->Save(); | 526 canvas->Save(); |
526 if (base::i18n::IsRTL()) { | 527 if (base::i18n::IsRTL()) { |
527 // Since we do not have the mirrored images for | 528 // Since we do not have the mirrored images for |
528 // (hot_)body_image_set->top_left, (hot_)body_image_set->left, | 529 // (hot_)body_image_set->top_left, (hot_)body_image_set->left, |
529 // (hot_)body_image_set->bottom_left, and drop_down_image_set, | 530 // (hot_)body_image_set->bottom_left, and drop_down_image_set, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 | 627 |
627 int mirrored_x = MirroredXWithWidthInsideView( | 628 int mirrored_x = MirroredXWithWidthInsideView( |
628 download_util::kSmallProgressIconSize, kTextWidth); | 629 download_util::kSmallProgressIconSize, kTextWidth); |
629 SkColor file_name_color = GetThemeProvider()->GetColor( | 630 SkColor file_name_color = GetThemeProvider()->GetColor( |
630 BrowserThemeProvider::COLOR_BOOKMARK_TEXT); | 631 BrowserThemeProvider::COLOR_BOOKMARK_TEXT); |
631 int y = | 632 int y = |
632 box_y_ + (show_status_text_ ? kVerticalPadding : | 633 box_y_ + (show_status_text_ ? kVerticalPadding : |
633 (box_height_ - font_.GetHeight()) / 2); | 634 (box_height_ - font_.GetHeight()) / 2); |
634 | 635 |
635 // Draw the file's name. | 636 // Draw the file's name. |
636 canvas->DrawStringInt(UTF16ToWide(filename), font_, | 637 canvas->DrawStringInt(filename, font_, |
637 IsEnabled() ? file_name_color : | 638 IsEnabled() ? file_name_color : |
638 kFileNameDisabledColor, | 639 kFileNameDisabledColor, |
639 mirrored_x, y, kTextWidth, font_.GetHeight()); | 640 mirrored_x, y, kTextWidth, font_.GetHeight()); |
640 } | 641 } |
641 | 642 |
642 // Paint the icon. | 643 // Paint the icon. |
643 IconManager* im = g_browser_process->icon_manager(); | 644 IconManager* im = g_browser_process->icon_manager(); |
644 SkBitmap* icon = IsDangerousMode() ? warning_icon_ : | 645 SkBitmap* icon = IsDangerousMode() ? warning_icon_ : |
645 im->LookupIcon(download_->GetUserVerifiedFilePath(), IconLoader::SMALL); | 646 im->LookupIcon(download_->GetUserVerifiedFilePath(), IconLoader::SMALL); |
646 | 647 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 | 1074 |
1074 // If the name has changed, call SetAccessibleName and notify | 1075 // If the name has changed, call SetAccessibleName and notify |
1075 // assistive technology that the name has changed so they can | 1076 // assistive technology that the name has changed so they can |
1076 // announce it immediately. | 1077 // announce it immediately. |
1077 if (new_name != current_name) { | 1078 if (new_name != current_name) { |
1078 SetAccessibleName(new_name); | 1079 SetAccessibleName(new_name); |
1079 if (GetWidget()) | 1080 if (GetWidget()) |
1080 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); | 1081 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); |
1081 } | 1082 } |
1082 } | 1083 } |
OLD | NEW |