| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 icon_large_ = image; | 454 icon_large_ = image; |
| 455 DownloadItemDrag::SetSource(body_.get(), get_download(), icon_large_); | 455 DownloadItemDrag::SetSource(body_.get(), get_download(), icon_large_); |
| 456 } | 456 } |
| 457 | 457 |
| 458 void DownloadItemGtk::LoadIcon() { | 458 void DownloadItemGtk::LoadIcon() { |
| 459 icon_consumer_.CancelAllRequests(); | 459 icon_consumer_.CancelAllRequests(); |
| 460 IconManager* im = g_browser_process->icon_manager(); | 460 IconManager* im = g_browser_process->icon_manager(); |
| 461 icon_filepath_ = get_download()->GetUserVerifiedFilePath(); | 461 icon_filepath_ = get_download()->GetUserVerifiedFilePath(); |
| 462 im->LoadIcon(icon_filepath_, | 462 im->LoadIcon(icon_filepath_, |
| 463 IconLoader::SMALL, &icon_consumer_, | 463 IconLoader::SMALL, &icon_consumer_, |
| 464 NewCallback(this, &DownloadItemGtk::OnLoadSmallIconComplete)); | 464 base::Bind(&DownloadItemGtk::OnLoadSmallIconComplete, |
| 465 base::Unretained(this))); |
| 465 im->LoadIcon(icon_filepath_, | 466 im->LoadIcon(icon_filepath_, |
| 466 IconLoader::LARGE, &icon_consumer_, | 467 IconLoader::LARGE, &icon_consumer_, |
| 467 NewCallback(this, &DownloadItemGtk::OnLoadLargeIconComplete)); | 468 base::Bind(&DownloadItemGtk::OnLoadLargeIconComplete, |
| 469 base::Unretained(this))); |
| 468 } | 470 } |
| 469 | 471 |
| 470 void DownloadItemGtk::UpdateTooltip() { | 472 void DownloadItemGtk::UpdateTooltip() { |
| 471 string16 elided_filename = ui::ElideFilename( | 473 string16 elided_filename = ui::ElideFilename( |
| 472 get_download()->GetFileNameToReportUser(), | 474 get_download()->GetFileNameToReportUser(), |
| 473 gfx::Font(), kTooltipMaxWidth); | 475 gfx::Font(), kTooltipMaxWidth); |
| 474 gtk_widget_set_tooltip_text(body_.get(), | 476 gtk_widget_set_tooltip_text(body_.get(), |
| 475 UTF16ToUTF8(elided_filename).c_str()); | 477 UTF16ToUTF8(elided_filename).c_str()); |
| 476 } | 478 } |
| 477 | 479 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 get_download()->DangerousDownloadValidated(); | 884 get_download()->DangerousDownloadValidated(); |
| 883 } | 885 } |
| 884 | 886 |
| 885 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { | 887 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { |
| 886 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 888 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
| 887 base::Time::Now() - creation_time_); | 889 base::Time::Now() - creation_time_); |
| 888 if (get_download()->IsPartialDownload()) | 890 if (get_download()->IsPartialDownload()) |
| 889 get_download()->Cancel(true); | 891 get_download()->Cancel(true); |
| 890 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 892 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 891 } | 893 } |
| OLD | NEW |