| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/external_protocol_dialog_gtk.h" | 5 #include "chrome/browser/gtk/external_protocol_dialog_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), vbox, | 91 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), vbox, |
| 92 FALSE, FALSE, 0); | 92 FALSE, FALSE, 0); |
| 93 | 93 |
| 94 g_signal_connect(dialog_, "response", | 94 g_signal_connect(dialog_, "response", |
| 95 G_CALLBACK(OnDialogResponseThunk), this); | 95 G_CALLBACK(OnDialogResponseThunk), this); |
| 96 | 96 |
| 97 gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE); | 97 gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE); |
| 98 gtk_widget_show_all(dialog_); | 98 gtk_widget_show_all(dialog_); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void ExternalProtocolDialogGtk::OnDialogResponse(int response) { | 101 void ExternalProtocolDialogGtk::OnDialogResponse(GtkWidget* widget, |
| 102 int response) { |
| 102 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox_))) { | 103 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox_))) { |
| 103 if (response == GTK_RESPONSE_ACCEPT) { | 104 if (response == GTK_RESPONSE_ACCEPT) { |
| 104 ExternalProtocolHandler::SetBlockState( | 105 ExternalProtocolHandler::SetBlockState( |
| 105 UTF8ToWide(url_.scheme()), ExternalProtocolHandler::DONT_BLOCK); | 106 UTF8ToWide(url_.scheme()), ExternalProtocolHandler::DONT_BLOCK); |
| 106 } else if (response == GTK_RESPONSE_REJECT) { | 107 } else if (response == GTK_RESPONSE_REJECT) { |
| 107 ExternalProtocolHandler::SetBlockState( | 108 ExternalProtocolHandler::SetBlockState( |
| 108 UTF8ToWide(url_.scheme()), ExternalProtocolHandler::BLOCK); | 109 UTF8ToWide(url_.scheme()), ExternalProtocolHandler::BLOCK); |
| 109 } | 110 } |
| 110 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing | 111 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing |
| 111 // the dialog, do nothing. | 112 // the dialog, do nothing. |
| 112 } | 113 } |
| 113 | 114 |
| 114 if (response == GTK_RESPONSE_ACCEPT) { | 115 if (response == GTK_RESPONSE_ACCEPT) { |
| 115 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", | 116 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", |
| 116 base::Time::Now() - creation_time_); | 117 base::Time::Now() - creation_time_); |
| 117 | 118 |
| 118 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_); | 119 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_); |
| 119 } | 120 } |
| 120 | 121 |
| 121 gtk_widget_destroy(dialog_); | 122 gtk_widget_destroy(dialog_); |
| 122 delete this; | 123 delete this; |
| 123 } | 124 } |
| OLD | NEW |