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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 shelf_->SchedulePaint(); | 267 shelf_->SchedulePaint(); |
268 } | 268 } |
269 | 269 |
270 // DownloadObserver interface. | 270 // DownloadObserver interface. |
271 | 271 |
272 // Update the progress graphic on the icon and our text status label | 272 // Update the progress graphic on the icon and our text status label |
273 // to reflect our current bytes downloaded, time remaining. | 273 // to reflect our current bytes downloaded, time remaining. |
274 void DownloadItemView::OnDownloadUpdated(DownloadItem* download_item) { | 274 void DownloadItemView::OnDownloadUpdated(DownloadItem* download_item) { |
275 DCHECK_EQ(download(), download_item); | 275 DCHECK_EQ(download(), download_item); |
276 | 276 |
| 277 if (!model_.ShouldShowInShelf()) { |
| 278 shelf_->RemoveDownloadView(this); // This will delete us! |
| 279 return; |
| 280 } |
| 281 |
277 if (IsShowingWarningDialog() && !model_.IsDangerous()) { | 282 if (IsShowingWarningDialog() && !model_.IsDangerous()) { |
278 // We have been approved. | 283 // We have been approved. |
279 ClearWarningDialog(); | 284 ClearWarningDialog(); |
280 } else if (!IsShowingWarningDialog() && model_.IsDangerous()) { | 285 } else if (!IsShowingWarningDialog() && model_.IsDangerous()) { |
281 ShowWarningDialog(); | 286 ShowWarningDialog(); |
282 // Force the shelf to layout again as our size has changed. | 287 // Force the shelf to layout again as our size has changed. |
283 shelf_->Layout(); | 288 shelf_->Layout(); |
284 SchedulePaint(); | 289 SchedulePaint(); |
285 } else { | 290 } else { |
286 base::string16 status_text = model_.GetStatusText(); | 291 base::string16 status_text = model_.GetStatusText(); |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 void DownloadItemView::AnimateStateTransition(State from, State to, | 1397 void DownloadItemView::AnimateStateTransition(State from, State to, |
1393 gfx::SlideAnimation* animation) { | 1398 gfx::SlideAnimation* animation) { |
1394 if (from == NORMAL && to == HOT) { | 1399 if (from == NORMAL && to == HOT) { |
1395 animation->Show(); | 1400 animation->Show(); |
1396 } else if (from == HOT && to == NORMAL) { | 1401 } else if (from == HOT && to == NORMAL) { |
1397 animation->Hide(); | 1402 animation->Hide(); |
1398 } else if (from != to) { | 1403 } else if (from != to) { |
1399 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1404 animation->Reset((to == HOT) ? 1.0 : 0.0); |
1400 } | 1405 } |
1401 } | 1406 } |
OLD | NEW |