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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 gfx::Point local_point = point; | 517 gfx::Point local_point = point; |
518 ConvertPointFromScreen(this, &local_point); | 518 ConvertPointFromScreen(this, &local_point); |
519 ShowContextMenuImpl(local_point, true); | 519 ShowContextMenuImpl(local_point, true); |
520 } | 520 } |
521 | 521 |
522 void DownloadItemView::ButtonPressed( | 522 void DownloadItemView::ButtonPressed( |
523 views::Button* sender, const ui::Event& event) { | 523 views::Button* sender, const ui::Event& event) { |
524 if (sender == discard_button_) { | 524 if (sender == discard_button_) { |
525 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 525 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
526 base::Time::Now() - creation_time_); | 526 base::Time::Now() - creation_time_); |
527 if (download()->IsPartialDownload()) | 527 download()->Remove(); |
528 download()->Cancel(true); | |
529 download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | |
530 // WARNING: we are deleted at this point. Don't access 'this'. | 528 // WARNING: we are deleted at this point. Don't access 'this'. |
531 } else if (save_button_ && sender == save_button_) { | 529 } else if (save_button_ && sender == save_button_) { |
532 // The user has confirmed a dangerous download. We'd record how quickly the | 530 // The user has confirmed a dangerous download. We'd record how quickly the |
533 // user did this to detect whether we're being clickjacked. | 531 // user did this to detect whether we're being clickjacked. |
534 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", | 532 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", |
535 base::Time::Now() - creation_time_); | 533 base::Time::Now() - creation_time_); |
536 // This will change the state and notify us. | 534 // This will change the state and notify us. |
537 download()->DangerousDownloadValidated(); | 535 download()->ValidateDangerousDownload(); |
538 } | 536 } |
539 } | 537 } |
540 | 538 |
541 void DownloadItemView::AnimationProgressed(const ui::Animation* animation) { | 539 void DownloadItemView::AnimationProgressed(const ui::Animation* animation) { |
542 // We don't care if what animation (body button/drop button/complete), | 540 // We don't care if what animation (body button/drop button/complete), |
543 // is calling back, as they all have to go through the same paint call. | 541 // is calling back, as they all have to go through the same paint call. |
544 SchedulePaint(); | 542 SchedulePaint(); |
545 } | 543 } |
546 | 544 |
547 // The DownloadItemView can be in three major modes (NORMAL_MODE, DANGEROUS_MODE | 545 // The DownloadItemView can be in three major modes (NORMAL_MODE, DANGEROUS_MODE |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 void DownloadItemView::AnimateStateTransition(State from, State to, | 1210 void DownloadItemView::AnimateStateTransition(State from, State to, |
1213 ui::SlideAnimation* animation) { | 1211 ui::SlideAnimation* animation) { |
1214 if (from == NORMAL && to == HOT) { | 1212 if (from == NORMAL && to == HOT) { |
1215 animation->Show(); | 1213 animation->Show(); |
1216 } else if (from == HOT && to == NORMAL) { | 1214 } else if (from == HOT && to == NORMAL) { |
1217 animation->Hide(); | 1215 animation->Hide(); |
1218 } else if (from != to) { | 1216 } else if (from != to) { |
1219 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1217 animation->Reset((to == HOT) ? 1.0 : 0.0); |
1220 } | 1218 } |
1221 } | 1219 } |
OLD | NEW |