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/download_item_view.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 int mirrored_x = GetMirroredXWithWidthInView( | 823 int mirrored_x = GetMirroredXWithWidthInView( |
824 download_util::kSmallProgressIconSize, kTextWidth); | 824 download_util::kSmallProgressIconSize, kTextWidth); |
825 SkColor file_name_color = GetThemeProvider()->GetColor( | 825 SkColor file_name_color = GetThemeProvider()->GetColor( |
826 ThemeService::COLOR_BOOKMARK_TEXT); | 826 ThemeService::COLOR_BOOKMARK_TEXT); |
827 int y = | 827 int y = |
828 box_y_ + (status_text_.empty() ? | 828 box_y_ + (status_text_.empty() ? |
829 ((box_height_ - font_.GetHeight()) / 2) : kVerticalPadding); | 829 ((box_height_ - font_.GetHeight()) / 2) : kVerticalPadding); |
830 | 830 |
831 // Draw the file's name. | 831 // Draw the file's name. |
832 canvas->DrawStringInt(filename, font_, | 832 canvas->DrawStringInt(filename, font_, |
833 IsEnabled() ? file_name_color : | 833 enabled() ? file_name_color |
834 kFileNameDisabledColor, | 834 : kFileNameDisabledColor, |
835 mirrored_x, y, kTextWidth, font_.GetHeight()); | 835 mirrored_x, y, kTextWidth, font_.GetHeight()); |
836 } | 836 } |
837 | 837 |
838 // Load the icon. | 838 // Load the icon. |
839 IconManager* im = g_browser_process->icon_manager(); | 839 IconManager* im = g_browser_process->icon_manager(); |
840 gfx::Image* image = im->LookupIcon(download_->GetUserVerifiedFilePath(), | 840 gfx::Image* image = im->LookupIcon(download_->GetUserVerifiedFilePath(), |
841 IconLoader::SMALL); | 841 IconLoader::SMALL); |
842 const SkBitmap* icon = NULL; | 842 const SkBitmap* icon = NULL; |
843 if (IsShowingWarningDialog()) | 843 if (IsShowingWarningDialog()) |
844 icon = warning_icon_; | 844 icon = warning_icon_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 int icon_x, icon_y; | 876 int icon_x, icon_y; |
877 | 877 |
878 if (IsShowingWarningDialog()) { | 878 if (IsShowingWarningDialog()) { |
879 icon_x = kLeftPadding + body_image_set->top_left->width(); | 879 icon_x = kLeftPadding + body_image_set->top_left->width(); |
880 icon_y = (height() - icon->height()) / 2; | 880 icon_y = (height() - icon->height()) / 2; |
881 } else { | 881 } else { |
882 icon_x = download_util::kSmallProgressIconOffset; | 882 icon_x = download_util::kSmallProgressIconOffset; |
883 icon_y = download_util::kSmallProgressIconOffset; | 883 icon_y = download_util::kSmallProgressIconOffset; |
884 } | 884 } |
885 icon_x = GetMirroredXWithWidthInView(icon_x, icon->width()); | 885 icon_x = GetMirroredXWithWidthInView(icon_x, icon->width()); |
886 if (IsEnabled()) { | 886 if (enabled()) { |
887 canvas->DrawBitmapInt(*icon, icon_x, icon_y); | 887 canvas->DrawBitmapInt(*icon, icon_x, icon_y); |
888 } else { | 888 } else { |
889 // Use an alpha to make the image look disabled. | 889 // Use an alpha to make the image look disabled. |
890 SkPaint paint; | 890 SkPaint paint; |
891 paint.setAlpha(120); | 891 paint.setAlpha(120); |
892 canvas->DrawBitmapInt(*icon, icon_x, icon_y, paint); | 892 canvas->DrawBitmapInt(*icon, icon_x, icon_y, paint); |
893 } | 893 } |
894 } | 894 } |
895 } | 895 } |
896 | 896 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 // Drop down button is glued to the left of the download shelf. | 1227 // Drop down button is glued to the left of the download shelf. |
1228 drop_down_x_left_ = 0; | 1228 drop_down_x_left_ = 0; |
1229 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); | 1229 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); |
1230 } else { | 1230 } else { |
1231 // Drop down button is glued to the right of the download shelf. | 1231 // Drop down button is glued to the right of the download shelf. |
1232 drop_down_x_left_ = | 1232 drop_down_x_left_ = |
1233 size.width() - normal_drop_down_image_set_.top->width(); | 1233 size.width() - normal_drop_down_image_set_.top->width(); |
1234 drop_down_x_right_ = size.width(); | 1234 drop_down_x_right_ = size.width(); |
1235 } | 1235 } |
1236 } | 1236 } |
OLD | NEW |