| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 l10n_util::GetStringUTF8(IDS_DISCARD_DOWNLOAD).c_str()); | 218 l10n_util::GetStringUTF8(IDS_DISCARD_DOWNLOAD).c_str()); |
| 219 g_signal_connect(dangerous_decline, "clicked", | 219 g_signal_connect(dangerous_decline, "clicked", |
| 220 G_CALLBACK(OnDangerousDeclineThunk), this); | 220 G_CALLBACK(OnDangerousDeclineThunk), this); |
| 221 gtk_util::CenterWidgetInHBox(dangerous_hbox_.get(), dangerous_decline, | 221 gtk_util::CenterWidgetInHBox(dangerous_hbox_.get(), dangerous_decline, |
| 222 false, 0); | 222 false, 0); |
| 223 | 223 |
| 224 // Create the ok button. | 224 // Create the ok button. |
| 225 GtkWidget* dangerous_accept = gtk_button_new_with_label( | 225 GtkWidget* dangerous_accept = gtk_button_new_with_label( |
| 226 l10n_util::GetStringUTF8( | 226 l10n_util::GetStringUTF8( |
| 227 download_model->download()->is_extension_install() ? | 227 download_model->download()->is_extension_install() ? |
| 228 IDS_CONTINUE_EXTENSION_DOWNLOAD : IDS_SAVE_DOWNLOAD).c_str()); | 228 IDS_CONTINUE_EXTENSION_DOWNLOAD : |
| 229 IDS_CONFIRM_DOWNLOAD).c_str()); |
| 229 g_signal_connect(dangerous_accept, "clicked", | 230 g_signal_connect(dangerous_accept, "clicked", |
| 230 G_CALLBACK(OnDangerousAcceptThunk), this); | 231 G_CALLBACK(OnDangerousAcceptThunk), this); |
| 231 gtk_util::CenterWidgetInHBox(dangerous_hbox_.get(), dangerous_accept, false, | 232 gtk_util::CenterWidgetInHBox(dangerous_hbox_.get(), dangerous_accept, false, |
| 232 0); | 233 0); |
| 233 | 234 |
| 234 // Put it in an alignment so that padding will be added on the left and | 235 // Put it in an alignment so that padding will be added on the left and |
| 235 // right. | 236 // right. |
| 236 dangerous_prompt_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 237 dangerous_prompt_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
| 237 gtk_alignment_set_padding(GTK_ALIGNMENT(dangerous_prompt_), | 238 gtk_alignment_set_padding(GTK_ALIGNMENT(dangerous_prompt_), |
| 238 0, 0, kDangerousElementPadding, kDangerousElementPadding); | 239 0, 0, kDangerousElementPadding, kDangerousElementPadding); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 get_download()->DangerousDownloadValidated(); | 863 get_download()->DangerousDownloadValidated(); |
| 863 } | 864 } |
| 864 | 865 |
| 865 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { | 866 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { |
| 866 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 867 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
| 867 base::Time::Now() - creation_time_); | 868 base::Time::Now() - creation_time_); |
| 868 if (get_download()->IsPartialDownload()) | 869 if (get_download()->IsPartialDownload()) |
| 869 get_download()->Cancel(true); | 870 get_download()->Cancel(true); |
| 870 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 871 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 871 } | 872 } |
| OLD | NEW |