| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/download_item_gtk.h" | 5 #include "chrome/browser/gtk/download_item_gtk.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/slide_animation.h" | 9 #include "app/slide_animation.h" |
| 10 #include "app/text_elider.h" | 10 #include "app/text_elider.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 LoadIcon(); | 345 LoadIcon(); |
| 346 | 346 |
| 347 UpdateTooltip(); | 347 UpdateTooltip(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 switch (download->state()) { | 350 switch (download->state()) { |
| 351 case DownloadItem::REMOVING: | 351 case DownloadItem::REMOVING: |
| 352 parent_shelf_->RemoveDownloadItem(this); // This will delete us! | 352 parent_shelf_->RemoveDownloadItem(this); // This will delete us! |
| 353 return; | 353 return; |
| 354 case DownloadItem::CANCELLED: | 354 case DownloadItem::CANCELLED: |
| 355 case DownloadItem::INTERRUPTED: |
| 355 StopDownloadProgress(); | 356 StopDownloadProgress(); |
| 356 gtk_widget_queue_draw(progress_area_.get()); | 357 gtk_widget_queue_draw(progress_area_.get()); |
| 357 break; | 358 break; |
| 358 case DownloadItem::COMPLETE: | 359 case DownloadItem::COMPLETE: |
| 359 if (download->auto_opened()) { | 360 if (download->auto_opened()) { |
| 360 parent_shelf_->RemoveDownloadItem(this); // This will delete us! | 361 parent_shelf_->RemoveDownloadItem(this); // This will delete us! |
| 361 return; | 362 return; |
| 362 } | 363 } |
| 363 StopDownloadProgress(); | 364 StopDownloadProgress(); |
| 364 | 365 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 849 |
| 849 void DownloadItemGtk::OnDangerousAccept(GtkWidget* button) { | 850 void DownloadItemGtk::OnDangerousAccept(GtkWidget* button) { |
| 850 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", | 851 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", |
| 851 base::Time::Now() - creation_time_); | 852 base::Time::Now() - creation_time_); |
| 852 get_download()->DangerousDownloadValidated(); | 853 get_download()->DangerousDownloadValidated(); |
| 853 } | 854 } |
| 854 | 855 |
| 855 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { | 856 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { |
| 856 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 857 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
| 857 base::Time::Now() - creation_time_); | 858 base::Time::Now() - creation_time_); |
| 858 if (get_download()->state() == DownloadItem::IN_PROGRESS) | 859 if (get_download()->IsPartialDownload()) |
| 859 get_download()->Cancel(true); | 860 get_download()->Cancel(true); |
| 860 get_download()->Remove(true); | 861 get_download()->Remove(true); |
| 861 } | 862 } |
| OLD | NEW |