| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 new_name = dangerous_download_label_->text(); | 1185 new_name = dangerous_download_label_->text(); |
| 1186 } else { | 1186 } else { |
| 1187 new_name = status_text_ + char16(' ') + | 1187 new_name = status_text_ + char16(' ') + |
| 1188 download()->GetFileNameToReportUser().LossyDisplayName(); | 1188 download()->GetFileNameToReportUser().LossyDisplayName(); |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 // If the name has changed, notify assistive technology that the name | 1191 // If the name has changed, notify assistive technology that the name |
| 1192 // has changed so they can announce it immediately. | 1192 // has changed so they can announce it immediately. |
| 1193 if (new_name != accessible_name_) { | 1193 if (new_name != accessible_name_) { |
| 1194 accessible_name_ = new_name; | 1194 accessible_name_ = new_name; |
| 1195 if (GetWidget()) { | 1195 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); |
| 1196 GetWidget()->NotifyAccessibilityEvent( | |
| 1197 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); | |
| 1198 } | |
| 1199 } | 1196 } |
| 1200 } | 1197 } |
| 1201 | 1198 |
| 1202 void DownloadItemView::UpdateDropDownButtonPosition() { | 1199 void DownloadItemView::UpdateDropDownButtonPosition() { |
| 1203 gfx::Size size = GetPreferredSize(); | 1200 gfx::Size size = GetPreferredSize(); |
| 1204 if (base::i18n::IsRTL()) { | 1201 if (base::i18n::IsRTL()) { |
| 1205 // Drop down button is glued to the left of the download shelf. | 1202 // Drop down button is glued to the left of the download shelf. |
| 1206 drop_down_x_left_ = 0; | 1203 drop_down_x_left_ = 0; |
| 1207 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); | 1204 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); |
| 1208 } else { | 1205 } else { |
| 1209 // Drop down button is glued to the right of the download shelf. | 1206 // Drop down button is glued to the right of the download shelf. |
| 1210 drop_down_x_left_ = | 1207 drop_down_x_left_ = |
| 1211 size.width() - normal_drop_down_image_set_.top->width(); | 1208 size.width() - normal_drop_down_image_set_.top->width(); |
| 1212 drop_down_x_right_ = size.width(); | 1209 drop_down_x_right_ = size.width(); |
| 1213 } | 1210 } |
| 1214 } | 1211 } |
| 1215 | 1212 |
| 1216 void DownloadItemView::AnimateStateTransition(State from, State to, | 1213 void DownloadItemView::AnimateStateTransition(State from, State to, |
| 1217 ui::SlideAnimation* animation) { | 1214 ui::SlideAnimation* animation) { |
| 1218 if (from == NORMAL && to == HOT) { | 1215 if (from == NORMAL && to == HOT) { |
| 1219 animation->Show(); | 1216 animation->Show(); |
| 1220 } else if (from == HOT && to == NORMAL) { | 1217 } else if (from == HOT && to == NORMAL) { |
| 1221 animation->Hide(); | 1218 animation->Hide(); |
| 1222 } else if (from != to) { | 1219 } else if (from != to) { |
| 1223 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1220 animation->Reset((to == HOT) ? 1.0 : 0.0); |
| 1224 } | 1221 } |
| 1225 } | 1222 } |
| OLD | NEW |