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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 DCHECK_EQ(download(), download_item); | 275 DCHECK_EQ(download(), download_item); |
276 | 276 |
277 if (IsShowingWarningDialog() && !model_.IsDangerous()) { | 277 if (IsShowingWarningDialog() && !model_.IsDangerous()) { |
278 // We have been approved. | 278 // We have been approved. |
279 ClearWarningDialog(); | 279 ClearWarningDialog(); |
280 } else if (!IsShowingWarningDialog() && model_.IsDangerous()) { | 280 } else if (!IsShowingWarningDialog() && model_.IsDangerous()) { |
281 ShowWarningDialog(); | 281 ShowWarningDialog(); |
282 // Force the shelf to layout again as our size has changed. | 282 // Force the shelf to layout again as our size has changed. |
283 shelf_->Layout(); | 283 shelf_->Layout(); |
284 SchedulePaint(); | 284 SchedulePaint(); |
285 } else if (!model_.ShouldShowInShelf()) { | |
286 shelf_->RemoveDownloadView(this); | |
287 return; | |
Dan Beam
2015/03/02 18:50:09
can move this earlier if this tickles the "return
asanka
2015/03/02 21:49:33
Yeah. For the reasons I mentioned in .mm above. Le
Dan Beam
2015/03/02 22:04:07
Done.
| |
285 } else { | 288 } else { |
286 base::string16 status_text = model_.GetStatusText(); | 289 base::string16 status_text = model_.GetStatusText(); |
287 switch (download()->GetState()) { | 290 switch (download()->GetState()) { |
288 case DownloadItem::IN_PROGRESS: | 291 case DownloadItem::IN_PROGRESS: |
289 download()->IsPaused() ? | 292 download()->IsPaused() ? |
290 StopDownloadProgress() : StartDownloadProgress(); | 293 StopDownloadProgress() : StartDownloadProgress(); |
291 LoadIconIfItemPathChanged(); | 294 LoadIconIfItemPathChanged(); |
292 break; | 295 break; |
293 case DownloadItem::INTERRUPTED: | 296 case DownloadItem::INTERRUPTED: |
294 StopDownloadProgress(); | 297 StopDownloadProgress(); |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1392 void DownloadItemView::AnimateStateTransition(State from, State to, | 1395 void DownloadItemView::AnimateStateTransition(State from, State to, |
1393 gfx::SlideAnimation* animation) { | 1396 gfx::SlideAnimation* animation) { |
1394 if (from == NORMAL && to == HOT) { | 1397 if (from == NORMAL && to == HOT) { |
1395 animation->Show(); | 1398 animation->Show(); |
1396 } else if (from == HOT && to == NORMAL) { | 1399 } else if (from == HOT && to == NORMAL) { |
1397 animation->Hide(); | 1400 animation->Hide(); |
1398 } else if (from != to) { | 1401 } else if (from != to) { |
1399 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1402 animation->Reset((to == HOT) ? 1.0 : 0.0); |
1400 } | 1403 } |
1401 } | 1404 } |
OLD | NEW |