| 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(WideToUTF16Hack(status_text_), font_, | 518 canvas->DrawStringInt(status_text_, font_, file_name_color, |
| 519 file_name_color, mirrored_x, y, kTextWidth, | 519 mirrored_x, y, kTextWidth, font_.GetHeight()); |
| 520 font_.GetHeight()); | |
| 521 } | 520 } |
| 522 } | 521 } |
| 523 | 522 |
| 524 // Paint the background images. | 523 // Paint the background images. |
| 525 int x = kLeftPadding; | 524 int x = kLeftPadding; |
| 526 canvas->Save(); | 525 canvas->Save(); |
| 527 if (base::i18n::IsRTL()) { | 526 if (base::i18n::IsRTL()) { |
| 528 // Since we do not have the mirrored images for | 527 // Since we do not have the mirrored images for |
| 529 // (hot_)body_image_set->top_left, (hot_)body_image_set->left, | 528 // (hot_)body_image_set->top_left, (hot_)body_image_set->left, |
| 530 // (hot_)body_image_set->bottom_left, and drop_down_image_set, | 529 // (hot_)body_image_set->bottom_left, and drop_down_image_set, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 626 |
| 628 int mirrored_x = MirroredXWithWidthInsideView( | 627 int mirrored_x = MirroredXWithWidthInsideView( |
| 629 download_util::kSmallProgressIconSize, kTextWidth); | 628 download_util::kSmallProgressIconSize, kTextWidth); |
| 630 SkColor file_name_color = GetThemeProvider()->GetColor( | 629 SkColor file_name_color = GetThemeProvider()->GetColor( |
| 631 BrowserThemeProvider::COLOR_BOOKMARK_TEXT); | 630 BrowserThemeProvider::COLOR_BOOKMARK_TEXT); |
| 632 int y = | 631 int y = |
| 633 box_y_ + (show_status_text_ ? kVerticalPadding : | 632 box_y_ + (show_status_text_ ? kVerticalPadding : |
| 634 (box_height_ - font_.GetHeight()) / 2); | 633 (box_height_ - font_.GetHeight()) / 2); |
| 635 | 634 |
| 636 // Draw the file's name. | 635 // Draw the file's name. |
| 637 canvas->DrawStringInt(filename, font_, | 636 canvas->DrawStringInt(UTF16ToWide(filename), font_, |
| 638 IsEnabled() ? file_name_color : | 637 IsEnabled() ? file_name_color : |
| 639 kFileNameDisabledColor, | 638 kFileNameDisabledColor, |
| 640 mirrored_x, y, kTextWidth, font_.GetHeight()); | 639 mirrored_x, y, kTextWidth, font_.GetHeight()); |
| 641 } | 640 } |
| 642 | 641 |
| 643 // Paint the icon. | 642 // Paint the icon. |
| 644 IconManager* im = g_browser_process->icon_manager(); | 643 IconManager* im = g_browser_process->icon_manager(); |
| 645 SkBitmap* icon = IsDangerousMode() ? warning_icon_ : | 644 SkBitmap* icon = IsDangerousMode() ? warning_icon_ : |
| 646 im->LookupIcon(download_->GetUserVerifiedFilePath(), IconLoader::SMALL); | 645 im->LookupIcon(download_->GetUserVerifiedFilePath(), IconLoader::SMALL); |
| 647 | 646 |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 | 1073 |
| 1075 // If the name has changed, call SetAccessibleName and notify | 1074 // If the name has changed, call SetAccessibleName and notify |
| 1076 // assistive technology that the name has changed so they can | 1075 // assistive technology that the name has changed so they can |
| 1077 // announce it immediately. | 1076 // announce it immediately. |
| 1078 if (new_name != current_name) { | 1077 if (new_name != current_name) { |
| 1079 SetAccessibleName(new_name); | 1078 SetAccessibleName(new_name); |
| 1080 if (GetWidget()) | 1079 if (GetWidget()) |
| 1081 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); | 1080 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); |
| 1082 } | 1081 } |
| 1083 } | 1082 } |
| OLD | NEW |