Chromium Code Reviews| 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 download_util::SMALL); | 818 download_util::SMALL); |
| 819 } else { | 819 } else { |
| 820 download_util::PaintDownloadComplete(canvas, this, 0, 0, | 820 download_util::PaintDownloadComplete(canvas, this, 0, 0, |
| 821 complete_animation_->GetCurrentValue(), | 821 complete_animation_->GetCurrentValue(), |
| 822 download_util::SMALL); | 822 download_util::SMALL); |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 } | 825 } |
| 826 | 826 |
| 827 // Draw the icon image. | 827 // Draw the icon image. |
| 828 int mirrored_x = GetMirroredXWithWidthInView( | 828 int icon_x, icon_y; |
| 829 download_util::kSmallProgressIconOffset, icon->width()); | 829 |
| 830 if (IsDangerousMode()) { | |
| 831 icon_x = GetMirroredXWithWidthInView( | |
| 832 kLeftPadding + dangerous_mode_body_image_set_.top_left->width(), | |
|
msw
2011/11/21 18:39:20
Is there a reason to add the 0px kLeftPadding here
msw
2011/11/21 18:39:20
Use the body_image_set local instead.
Can you cons
asanka
2011/11/21 20:45:32
Done.
asanka
2011/11/21 20:45:32
I'm mirroring the logic in DIV::Layout() and DIV::
| |
| 833 icon->width()); | |
| 834 icon_y = (height() - icon->height()) / 2; | |
| 835 } else { | |
| 836 icon_x = GetMirroredXWithWidthInView( | |
| 837 download_util::kSmallProgressIconOffset, icon->width()); | |
| 838 icon_y = download_util::kSmallProgressIconOffset; | |
| 839 } | |
| 830 if (IsEnabled()) { | 840 if (IsEnabled()) { |
| 831 canvas->DrawBitmapInt(*icon, mirrored_x, | 841 canvas->DrawBitmapInt(*icon, icon_x, icon_y); |
| 832 download_util::kSmallProgressIconOffset); | |
| 833 } else { | 842 } else { |
| 834 // Use an alpha to make the image look disabled. | 843 // Use an alpha to make the image look disabled. |
| 835 SkPaint paint; | 844 SkPaint paint; |
| 836 paint.setAlpha(120); | 845 paint.setAlpha(120); |
| 837 canvas->DrawBitmapInt(*icon, mirrored_x, | 846 canvas->DrawBitmapInt(*icon, icon_x, icon_y, paint); |
| 838 download_util::kSmallProgressIconOffset, paint); | |
| 839 } | 847 } |
| 840 } | 848 } |
| 841 } | 849 } |
| 842 | 850 |
| 843 void DownloadItemView::OpenDownload() { | 851 void DownloadItemView::OpenDownload() { |
| 844 // We're interested in how long it takes users to open downloads. If they | 852 // We're interested in how long it takes users to open downloads. If they |
| 845 // open downloads super quickly, we should be concerned about clickjacking. | 853 // open downloads super quickly, we should be concerned about clickjacking. |
| 846 UMA_HISTOGRAM_LONG_TIMES("clickjacking.open_download", | 854 UMA_HISTOGRAM_LONG_TIMES("clickjacking.open_download", |
| 847 base::Time::Now() - creation_time_); | 855 base::Time::Now() - creation_time_); |
| 848 download_->OpenDownload(); | 856 download_->OpenDownload(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1124 // If the name has changed, notify assistive technology that the name | 1132 // If the name has changed, notify assistive technology that the name |
| 1125 // has changed so they can announce it immediately. | 1133 // has changed so they can announce it immediately. |
| 1126 if (new_name != accessible_name_) { | 1134 if (new_name != accessible_name_) { |
| 1127 accessible_name_ = new_name; | 1135 accessible_name_ = new_name; |
| 1128 if (GetWidget()) { | 1136 if (GetWidget()) { |
| 1129 GetWidget()->NotifyAccessibilityEvent( | 1137 GetWidget()->NotifyAccessibilityEvent( |
| 1130 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); | 1138 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); |
| 1131 } | 1139 } |
| 1132 } | 1140 } |
| 1133 } | 1141 } |
| OLD | NEW |