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

Side by Side Diff: chrome/browser/ui/gtk/external_protocol_dialog_gtk.cc

Issue 6627038: gtk: Rename OnDialogResponse() to OnResponse() to standardize on a consistent naming scheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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) 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/external_protocol_dialog_gtk.h" 5 #include "chrome/browser/ui/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
91 // Add the checkbox. 91 // Add the checkbox.
92 checkbox_ = gtk_check_button_new_with_label( 92 checkbox_ = gtk_check_button_new_with_label(
93 l10n_util::GetStringUTF8(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT).c_str()); 93 l10n_util::GetStringUTF8(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT).c_str());
94 gtk_box_pack_start(GTK_BOX(vbox), checkbox_, 94 gtk_box_pack_start(GTK_BOX(vbox), checkbox_,
95 FALSE, FALSE, 0); 95 FALSE, FALSE, 0);
96 96
97 // Add our vbox to the dialog. 97 // Add our vbox to the dialog.
98 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), vbox, 98 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), vbox,
99 FALSE, FALSE, 0); 99 FALSE, FALSE, 0);
100 100
101 g_signal_connect(dialog_, "response", 101 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
102 G_CALLBACK(OnDialogResponseThunk), this);
103 102
104 gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE); 103 gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE);
105 gtk_widget_show_all(dialog_); 104 gtk_widget_show_all(dialog_);
106 } 105 }
107 106
108 void ExternalProtocolDialogGtk::OnDialogResponse(GtkWidget* widget, 107 ExternalProtocolDialogGtk::~ExternalProtocolDialogGtk() {
109 int response) { 108 }
109
110 void ExternalProtocolDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
110 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox_))) { 111 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox_))) {
111 if (response == GTK_RESPONSE_ACCEPT) { 112 if (response_id == GTK_RESPONSE_ACCEPT) {
112 ExternalProtocolHandler::SetBlockState( 113 ExternalProtocolHandler::SetBlockState(
113 url_.scheme(), ExternalProtocolHandler::DONT_BLOCK); 114 url_.scheme(), ExternalProtocolHandler::DONT_BLOCK);
114 } else if (response == GTK_RESPONSE_REJECT) { 115 } else if (response_id == GTK_RESPONSE_REJECT) {
115 ExternalProtocolHandler::SetBlockState( 116 ExternalProtocolHandler::SetBlockState(
116 url_.scheme(), ExternalProtocolHandler::BLOCK); 117 url_.scheme(), ExternalProtocolHandler::BLOCK);
117 } 118 }
118 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing 119 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing
119 // the dialog, do nothing. 120 // the dialog, do nothing.
120 } 121 }
121 122
122 if (response == GTK_RESPONSE_ACCEPT) { 123 if (response_id == GTK_RESPONSE_ACCEPT) {
123 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", 124 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url",
124 base::TimeTicks::Now() - creation_time_); 125 base::TimeTicks::Now() - creation_time_);
125 126
126 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_); 127 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_);
127 } 128 }
128 129
129 gtk_widget_destroy(dialog_); 130 gtk_widget_destroy(dialog_);
130 delete this; 131 delete this;
131 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698