| 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 #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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 dropdown_button_->SetVisible(mode_ == MALICIOUS_MODE); | 965 dropdown_button_->SetVisible(mode_ == MALICIOUS_MODE); |
| 966 } | 966 } |
| 967 | 967 |
| 968 gfx::ImageSkia DownloadItemView::GetWarningIcon() { | 968 gfx::ImageSkia DownloadItemView::GetWarningIcon() { |
| 969 switch (download()->GetDangerType()) { | 969 switch (download()->GetDangerType()) { |
| 970 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: | 970 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: |
| 971 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: | 971 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: |
| 972 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: | 972 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: |
| 973 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: | 973 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: |
| 974 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: | 974 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: |
| 975 return gfx::CreateVectorIcon(gfx::VectorIconId::REMOVE_CIRCLE, | 975 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: |
| 976 return gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, |
| 976 kWarningIconSize, gfx::kGoogleRed700); | 977 kWarningIconSize, gfx::kGoogleRed700); |
| 977 | 978 |
| 978 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: | 979 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: |
| 979 case content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: | 980 case content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: |
| 980 case content::DOWNLOAD_DANGER_TYPE_USER_VALIDATED: | 981 case content::DOWNLOAD_DANGER_TYPE_USER_VALIDATED: |
| 981 case content::DOWNLOAD_DANGER_TYPE_MAX: | 982 case content::DOWNLOAD_DANGER_TYPE_MAX: |
| 982 NOTREACHED(); | 983 NOTREACHED(); |
| 983 break; | 984 break; |
| 984 | |
| 985 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: | |
| 986 return gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, kWarningIconSize, | |
| 987 gfx::kGoogleYellow700); | |
| 988 } | 985 } |
| 989 return gfx::ImageSkia(); | 986 return gfx::ImageSkia(); |
| 990 } | 987 } |
| 991 | 988 |
| 992 gfx::Size DownloadItemView::GetButtonSize() const { | 989 gfx::Size DownloadItemView::GetButtonSize() const { |
| 993 DCHECK(discard_button_ && (mode_ == MALICIOUS_MODE || save_button_)); | 990 DCHECK(discard_button_ && (mode_ == MALICIOUS_MODE || save_button_)); |
| 994 gfx::Size size = discard_button_->GetPreferredSize(); | 991 gfx::Size size = discard_button_->GetPreferredSize(); |
| 995 if (save_button_) | 992 if (save_button_) |
| 996 size.SetToMax(save_button_->GetPreferredSize()); | 993 size.SetToMax(save_button_->GetPreferredSize()); |
| 997 return size; | 994 return size; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 SchedulePaint(); | 1104 SchedulePaint(); |
| 1108 } | 1105 } |
| 1109 | 1106 |
| 1110 SkColor DownloadItemView::GetTextColor() const { | 1107 SkColor DownloadItemView::GetTextColor() const { |
| 1111 return GetTextColorForThemeProvider(GetThemeProvider()); | 1108 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1112 } | 1109 } |
| 1113 | 1110 |
| 1114 SkColor DownloadItemView::GetDimmedTextColor() const { | 1111 SkColor DownloadItemView::GetDimmedTextColor() const { |
| 1115 return SkColorSetA(GetTextColor(), 0xC7); | 1112 return SkColorSetA(GetTextColor(), 0xC7); |
| 1116 } | 1113 } |
| OLD | NEW |