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

Side by Side Diff: chrome/browser/ui/gtk/download/download_item_gtk.cc

Issue 10421021: Make DownloadProtectionService not use BrowserList::GetLastActive() to load a link. Instead pass th… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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/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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 889 }
890 return FALSE; 890 return FALSE;
891 } 891 }
892 892
893 void DownloadItemGtk::ShowPopupMenu(GtkWidget* button, 893 void DownloadItemGtk::ShowPopupMenu(GtkWidget* button,
894 GdkEventButton* event) { 894 GdkEventButton* event) {
895 // Stop any completion animation. 895 // Stop any completion animation.
896 if (complete_animation_.is_animating()) 896 if (complete_animation_.is_animating())
897 complete_animation_.End(); 897 complete_animation_.End();
898 898
899 if (!menu_.get()) 899 if (!menu_.get()) {
900 menu_.reset(new DownloadShelfContextMenuGtk(download_model_.get(), this)); 900 menu_.reset(new DownloadShelfContextMenuGtk(download_model_.get(),
901 this,
902 parent_shelf_->GetNavigator()));
903 }
901 menu_->Popup(button, event); 904 menu_->Popup(button, event);
902 } 905 }
903 906
904 gboolean DownloadItemGtk::OnDangerousPromptExpose(GtkWidget* widget, 907 gboolean DownloadItemGtk::OnDangerousPromptExpose(GtkWidget* widget,
905 GdkEventExpose* event) { 908 GdkEventExpose* event) {
906 TRACE_EVENT0("ui::gtk", "DownloadItemGtk::OnDangerousPromptExpose"); 909 TRACE_EVENT0("ui::gtk", "DownloadItemGtk::OnDangerousPromptExpose");
907 if (!theme_service_->UsingNativeTheme()) { 910 if (!theme_service_->UsingNativeTheme()) {
908 // The hbox renderer will take care of the border when in GTK mode. 911 // The hbox renderer will take care of the border when in GTK mode.
909 dangerous_nine_box_->RenderToWidget(widget); 912 dangerous_nine_box_->RenderToWidget(widget);
910 } 913 }
911 return FALSE; // Continue propagation. 914 return FALSE; // Continue propagation.
912 } 915 }
913 916
914 void DownloadItemGtk::OnDangerousAccept(GtkWidget* button) { 917 void DownloadItemGtk::OnDangerousAccept(GtkWidget* button) {
915 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", 918 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download",
916 base::Time::Now() - creation_time_); 919 base::Time::Now() - creation_time_);
917 get_download()->DangerousDownloadValidated(); 920 get_download()->DangerousDownloadValidated();
918 } 921 }
919 922
920 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { 923 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) {
921 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", 924 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download",
922 base::Time::Now() - creation_time_); 925 base::Time::Now() - creation_time_);
923 if (get_download()->IsPartialDownload()) 926 if (get_download()->IsPartialDownload())
924 get_download()->Cancel(true); 927 get_download()->Cancel(true);
925 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 928 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
926 } 929 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698