Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 14947007: [Downloads] Allow acquiring dangerous download file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods for consistency Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (download()->IsPartialDownload())
528 download()->Cancel(true); 528 download()->Cancel(true);
529 download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 529 download()->DiscardDangerousDownload(
530 DownloadItem::DELETE_DUE_TO_USER_DISCARD,
531 DownloadItem::AcquireFileCallback());
530 // WARNING: we are deleted at this point. Don't access 'this'. 532 // WARNING: we are deleted at this point. Don't access 'this'.
531 } else if (save_button_ && sender == save_button_) { 533 } else if (save_button_ && sender == save_button_) {
532 // The user has confirmed a dangerous download. We'd record how quickly the 534 // The user has confirmed a dangerous download. We'd record how quickly the
533 // user did this to detect whether we're being clickjacked. 535 // user did this to detect whether we're being clickjacked.
534 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", 536 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download",
535 base::Time::Now() - creation_time_); 537 base::Time::Now() - creation_time_);
536 // This will change the state and notify us. 538 // This will change the state and notify us.
537 download()->DangerousDownloadValidated(); 539 download()->ValidateDangerousDownload();
538 } 540 }
539 } 541 }
540 542
541 void DownloadItemView::AnimationProgressed(const ui::Animation* animation) { 543 void DownloadItemView::AnimationProgressed(const ui::Animation* animation) {
542 // We don't care if what animation (body button/drop button/complete), 544 // 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. 545 // is calling back, as they all have to go through the same paint call.
544 SchedulePaint(); 546 SchedulePaint();
545 } 547 }
546 548
547 // The DownloadItemView can be in three major modes (NORMAL_MODE, DANGEROUS_MODE 549 // The DownloadItemView can be in three major modes (NORMAL_MODE, DANGEROUS_MODE
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 void DownloadItemView::AnimateStateTransition(State from, State to, 1214 void DownloadItemView::AnimateStateTransition(State from, State to,
1213 ui::SlideAnimation* animation) { 1215 ui::SlideAnimation* animation) {
1214 if (from == NORMAL && to == HOT) { 1216 if (from == NORMAL && to == HOT) {
1215 animation->Show(); 1217 animation->Show();
1216 } else if (from == HOT && to == NORMAL) { 1218 } else if (from == HOT && to == NORMAL) {
1217 animation->Hide(); 1219 animation->Hide();
1218 } else if (from != to) { 1220 } else if (from != to) {
1219 animation->Reset((to == HOT) ? 1.0 : 0.0); 1221 animation->Reset((to == HOT) ? 1.0 : 0.0);
1220 } 1222 }
1221 } 1223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698