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

Side by Side Diff: chrome/browser/ui/gtk/clear_browsing_data_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/clear_browsing_data_dialog_gtk.h" 5 #include "chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/browser/browsing_data_remover.h" 9 #include "chrome/browser/browsing_data_remover.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 DCHECK_EQ(GTK_DIALOG(dialog_)->action_area->parent, content_area); 162 DCHECK_EQ(GTK_DIALOG(dialog_)->action_area->parent, content_area);
163 163
164 // Now rearrange those because they're *above* the accept buttons...there's 164 // Now rearrange those because they're *above* the accept buttons...there's
165 // no way to place them in the correct position with gtk_box_pack_end() so 165 // no way to place them in the correct position with gtk_box_pack_end() so
166 // manually move things into the correct order. 166 // manually move things into the correct order.
167 gtk_box_reorder_child(GTK_BOX(content_area), flash_link_hbox, -1); 167 gtk_box_reorder_child(GTK_BOX(content_area), flash_link_hbox, -1);
168 gtk_box_reorder_child(GTK_BOX(content_area), separator, -1); 168 gtk_box_reorder_child(GTK_BOX(content_area), separator, -1);
169 gtk_box_reorder_child(GTK_BOX(content_area), GTK_DIALOG(dialog_)->action_area, 169 gtk_box_reorder_child(GTK_BOX(content_area), GTK_DIALOG(dialog_)->action_area,
170 -1); 170 -1);
171 171
172 g_signal_connect(dialog_, "response", 172 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
173 G_CALLBACK(OnDialogResponseThunk), this);
174 173
175 UpdateDialogButtons(); 174 UpdateDialogButtons();
176 175
177 gtk_util::ShowModalDialogWithMinLocalizedWidth(dialog_, 176 gtk_util::ShowModalDialogWithMinLocalizedWidth(dialog_,
178 IDS_CLEARDATA_DIALOG_WIDTH_CHARS); 177 IDS_CLEARDATA_DIALOG_WIDTH_CHARS);
179 } 178 }
180 179
181 ClearBrowsingDataDialogGtk::~ClearBrowsingDataDialogGtk() { 180 ClearBrowsingDataDialogGtk::~ClearBrowsingDataDialogGtk() {
182 } 181 }
183 182
184 void ClearBrowsingDataDialogGtk::OnDialogResponse(GtkWidget* widget, 183 void ClearBrowsingDataDialogGtk::OnResponse(GtkWidget* dialog,
185 int response) { 184 int response_id) {
186 if (response == GTK_RESPONSE_ACCEPT) { 185 if (response_id == GTK_RESPONSE_ACCEPT) {
187 PrefService* prefs = profile_->GetPrefs(); 186 PrefService* prefs = profile_->GetPrefs();
188 prefs->SetBoolean(prefs::kDeleteBrowsingHistory, 187 prefs->SetBoolean(prefs::kDeleteBrowsingHistory,
189 IsChecked(del_history_checkbox_)); 188 IsChecked(del_history_checkbox_));
190 prefs->SetBoolean(prefs::kDeleteDownloadHistory, 189 prefs->SetBoolean(prefs::kDeleteDownloadHistory,
191 IsChecked(del_downloads_checkbox_)); 190 IsChecked(del_downloads_checkbox_));
192 prefs->SetBoolean(prefs::kDeleteCache, 191 prefs->SetBoolean(prefs::kDeleteCache,
193 IsChecked(del_cache_checkbox_)); 192 IsChecked(del_cache_checkbox_));
194 prefs->SetBoolean(prefs::kDeleteCookies, 193 prefs->SetBoolean(prefs::kDeleteCookies,
195 IsChecked(del_cookies_checkbox_)); 194 IsChecked(del_cookies_checkbox_));
196 prefs->SetBoolean(prefs::kDeletePasswords, 195 prefs->SetBoolean(prefs::kDeletePasswords,
197 IsChecked(del_passwords_checkbox_)); 196 IsChecked(del_passwords_checkbox_));
198 prefs->SetBoolean(prefs::kDeleteFormData, 197 prefs->SetBoolean(prefs::kDeleteFormData,
199 IsChecked(del_form_data_checkbox_)); 198 IsChecked(del_form_data_checkbox_));
200 prefs->SetInteger(prefs::kDeleteTimePeriod, 199 prefs->SetInteger(prefs::kDeleteTimePeriod,
201 gtk_combo_box_get_active(GTK_COMBO_BOX(time_period_combobox_))); 200 gtk_combo_box_get_active(GTK_COMBO_BOX(time_period_combobox_)));
202 201
203 int period_selected = gtk_combo_box_get_active( 202 int period_selected = gtk_combo_box_get_active(
204 GTK_COMBO_BOX(time_period_combobox_)); 203 GTK_COMBO_BOX(time_period_combobox_));
205 204
206 // BrowsingDataRemover deletes itself when done. 205 // BrowsingDataRemover deletes itself when done.
207 remover_ = new BrowsingDataRemover(profile_, 206 remover_ = new BrowsingDataRemover(profile_,
208 static_cast<BrowsingDataRemover::TimePeriod>(period_selected), 207 static_cast<BrowsingDataRemover::TimePeriod>(period_selected),
209 base::Time()); 208 base::Time());
210 remover_->Remove(GetCheckedItems()); 209 remover_->Remove(GetCheckedItems());
211 } 210 }
212 211
213 delete this; 212 delete this;
214 gtk_widget_destroy(GTK_WIDGET(widget)); 213 gtk_widget_destroy(dialog);
215 } 214 }
216 215
217 void ClearBrowsingDataDialogGtk::OnDialogWidgetClicked(GtkWidget* widget) { 216 void ClearBrowsingDataDialogGtk::OnDialogWidgetClicked(GtkWidget* widget) {
218 UpdateDialogButtons(); 217 UpdateDialogButtons();
219 } 218 }
220 219
221 void ClearBrowsingDataDialogGtk::OnFlashLinkClicked(GtkWidget* button) { 220 void ClearBrowsingDataDialogGtk::OnFlashLinkClicked(GtkWidget* button) {
222 // We open a new browser window so the Options dialog doesn't get lost 221 // We open a new browser window so the Options dialog doesn't get lost
223 // behind other windows. 222 // behind other windows.
224 Browser* browser = Browser::Create(profile_); 223 Browser* browser = Browser::Create(profile_);
(...skipping 16 matching lines...) Expand all
241 if (IsChecked(del_cookies_checkbox_)) 240 if (IsChecked(del_cookies_checkbox_))
242 items |= BrowsingDataRemover::REMOVE_COOKIES; 241 items |= BrowsingDataRemover::REMOVE_COOKIES;
243 if (IsChecked(del_passwords_checkbox_)) 242 if (IsChecked(del_passwords_checkbox_))
244 items |= BrowsingDataRemover::REMOVE_PASSWORDS; 243 items |= BrowsingDataRemover::REMOVE_PASSWORDS;
245 if (IsChecked(del_form_data_checkbox_)) 244 if (IsChecked(del_form_data_checkbox_))
246 items |= BrowsingDataRemover::REMOVE_FORM_DATA; 245 items |= BrowsingDataRemover::REMOVE_FORM_DATA;
247 if (IsChecked(del_cache_checkbox_)) 246 if (IsChecked(del_cache_checkbox_))
248 items |= BrowsingDataRemover::REMOVE_CACHE; 247 items |= BrowsingDataRemover::REMOVE_CACHE;
249 return items; 248 return items;
250 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698