| 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/gtk/download/download_item_gtk.h" | 5 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 451 |
| 452 // Icon loading functions. | 452 // Icon loading functions. |
| 453 | 453 |
| 454 void DownloadItemGtk::OnLoadSmallIconComplete(gfx::Image* image) { | 454 void DownloadItemGtk::OnLoadSmallIconComplete(gfx::Image* image) { |
| 455 icon_small_ = image; | 455 icon_small_ = image; |
| 456 gtk_widget_queue_draw(progress_area_.get()); | 456 gtk_widget_queue_draw(progress_area_.get()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 void DownloadItemGtk::OnLoadLargeIconComplete(gfx::Image* image) { | 459 void DownloadItemGtk::OnLoadLargeIconComplete(gfx::Image* image) { |
| 460 icon_large_ = image; | 460 icon_large_ = image; |
| 461 DownloadItemDrag::SetSource(body_.get(), download(), icon_large_); | 461 if (download()->IsComplete()) |
| 462 DownloadItemDrag::SetSource(body_.get(), download(), icon_large_); |
| 463 // Else, the download will be made draggable once an OnDownloadUpdated() |
| 464 // notification is received with download->IsComplete(). |
| 462 } | 465 } |
| 463 | 466 |
| 464 void DownloadItemGtk::LoadIcon() { | 467 void DownloadItemGtk::LoadIcon() { |
| 465 cancelable_task_tracker_.TryCancelAll(); | 468 cancelable_task_tracker_.TryCancelAll(); |
| 466 IconManager* im = g_browser_process->icon_manager(); | 469 IconManager* im = g_browser_process->icon_manager(); |
| 467 icon_filepath_ = download()->GetUserVerifiedFilePath(); | 470 icon_filepath_ = download()->GetUserVerifiedFilePath(); |
| 468 im->LoadIcon(icon_filepath_, | 471 im->LoadIcon(icon_filepath_, |
| 469 IconLoader::SMALL, | 472 IconLoader::SMALL, |
| 470 base::Bind(&DownloadItemGtk::OnLoadSmallIconComplete, | 473 base::Bind(&DownloadItemGtk::OnLoadSmallIconComplete, |
| 471 base::Unretained(this)), | 474 base::Unretained(this)), |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 download()->DangerousDownloadValidated(); | 923 download()->DangerousDownloadValidated(); |
| 921 } | 924 } |
| 922 | 925 |
| 923 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { | 926 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { |
| 924 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 927 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
| 925 base::Time::Now() - creation_time_); | 928 base::Time::Now() - creation_time_); |
| 926 if (download()->IsPartialDownload()) | 929 if (download()->IsPartialDownload()) |
| 927 download()->Cancel(true); | 930 download()->Cancel(true); |
| 928 download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 931 download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 929 } | 932 } |
| OLD | NEW |