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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 void DownloadItemGtk::OnLoadLargeIconComplete(IconManager::Handle handle, | 461 void DownloadItemGtk::OnLoadLargeIconComplete(IconManager::Handle handle, |
462 gfx::Image* image) { | 462 gfx::Image* image) { |
463 icon_large_ = image; | 463 icon_large_ = image; |
464 DownloadItemDrag::SetSource(body_.get(), get_download(), icon_large_); | 464 DownloadItemDrag::SetSource(body_.get(), get_download(), icon_large_); |
465 } | 465 } |
466 | 466 |
467 void DownloadItemGtk::LoadIcon() { | 467 void DownloadItemGtk::LoadIcon() { |
468 icon_consumer_.CancelAllRequests(); | 468 icon_consumer_.CancelAllRequests(); |
469 IconManager* im = g_browser_process->icon_manager(); | 469 IconManager* im = g_browser_process->icon_manager(); |
470 icon_filepath_ = get_download()->GetUserVerifiedFilePath(); | 470 icon_filepath_ = get_download()->GetUserVerifiedFilePath(); |
| 471 if (icon_filepath_.empty()) return; |
471 im->LoadIcon(icon_filepath_, | 472 im->LoadIcon(icon_filepath_, |
472 IconLoader::SMALL, &icon_consumer_, | 473 IconLoader::SMALL, &icon_consumer_, |
473 base::Bind(&DownloadItemGtk::OnLoadSmallIconComplete, | 474 base::Bind(&DownloadItemGtk::OnLoadSmallIconComplete, |
474 base::Unretained(this))); | 475 base::Unretained(this))); |
475 im->LoadIcon(icon_filepath_, | 476 im->LoadIcon(icon_filepath_, |
476 IconLoader::LARGE, &icon_consumer_, | 477 IconLoader::LARGE, &icon_consumer_, |
477 base::Bind(&DownloadItemGtk::OnLoadLargeIconComplete, | 478 base::Bind(&DownloadItemGtk::OnLoadLargeIconComplete, |
478 base::Unretained(this))); | 479 base::Unretained(this))); |
479 } | 480 } |
480 | 481 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 get_download()->DangerousDownloadValidated(); | 923 get_download()->DangerousDownloadValidated(); |
923 } | 924 } |
924 | 925 |
925 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { | 926 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { |
926 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 927 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
927 base::Time::Now() - creation_time_); | 928 base::Time::Now() - creation_time_); |
928 if (get_download()->IsPartialDownload()) | 929 if (get_download()->IsPartialDownload()) |
929 get_download()->Cancel(true); | 930 get_download()->Cancel(true); |
930 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 931 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
931 } | 932 } |
OLD | NEW |