| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { | 326 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { |
| 327 disabled_while_opening_ = true; | 327 disabled_while_opening_ = true; |
| 328 SetEnabled(false); | 328 SetEnabled(false); |
| 329 base::MessageLoop::current()->PostDelayedTask( | 329 base::MessageLoop::current()->PostDelayedTask( |
| 330 FROM_HERE, | 330 FROM_HERE, |
| 331 base::Bind(&DownloadItemView::Reenable, weak_ptr_factory_.GetWeakPtr()), | 331 base::Bind(&DownloadItemView::Reenable, weak_ptr_factory_.GetWeakPtr()), |
| 332 base::TimeDelta::FromMilliseconds(kDisabledOnOpenDuration)); | 332 base::TimeDelta::FromMilliseconds(kDisabledOnOpenDuration)); |
| 333 | 333 |
| 334 // Notify our parent. | 334 // Notify our parent. |
| 335 shelf_->OpenedDownload(this); | 335 shelf_->OnDownloadOpened(this); |
| 336 } |
| 337 |
| 338 void DownloadItemView::OnDownloadShown(DownloadItem* download) { |
| 339 shelf_->OnDownloadShown(this); |
| 336 } | 340 } |
| 337 | 341 |
| 338 // View overrides | 342 // View overrides |
| 339 | 343 |
| 340 // In dangerous mode we have to layout our buttons. | 344 // In dangerous mode we have to layout our buttons. |
| 341 void DownloadItemView::Layout() { | 345 void DownloadItemView::Layout() { |
| 342 if (IsShowingWarningDialog()) { | 346 if (IsShowingWarningDialog()) { |
| 343 BodyImageSet* body_image_set = | 347 BodyImageSet* body_image_set = |
| 344 (mode_ == DANGEROUS_MODE) ? &dangerous_mode_body_image_set_ : | 348 (mode_ == DANGEROUS_MODE) ? &dangerous_mode_body_image_set_ : |
| 345 &malicious_mode_body_image_set_; | 349 &malicious_mode_body_image_set_; |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 void DownloadItemView::AnimateStateTransition(State from, State to, | 1347 void DownloadItemView::AnimateStateTransition(State from, State to, |
| 1344 gfx::SlideAnimation* animation) { | 1348 gfx::SlideAnimation* animation) { |
| 1345 if (from == NORMAL && to == HOT) { | 1349 if (from == NORMAL && to == HOT) { |
| 1346 animation->Show(); | 1350 animation->Show(); |
| 1347 } else if (from == HOT && to == NORMAL) { | 1351 } else if (from == HOT && to == NORMAL) { |
| 1348 animation->Hide(); | 1352 animation->Hide(); |
| 1349 } else if (from != to) { | 1353 } else if (from != to) { |
| 1350 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1354 animation->Reset((to == HOT) ? 1.0 : 0.0); |
| 1351 } | 1355 } |
| 1352 } | 1356 } |
| OLD | NEW |