summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 19:38:08 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 19:38:08 +0000
commit7b6fe474c5db2e54dec8928fec6896355d318086 (patch)
tree5445c0c2ba03932e57734af620b365cd42656fc1 /chrome
parentcb63c05d1198b8bb61b01cb057a1345acf5be853 (diff)
downloadchromium_src-7b6fe474c5db2e54dec8928fec6896355d318086.zip
chromium_src-7b6fe474c5db2e54dec8928fec6896355d318086.tar.gz
chromium_src-7b6fe474c5db2e54dec8928fec6896355d318086.tar.bz2
Convert the first half of gtk/options/* to use the new signal handler macros.
BUG=NONE TEST=trybots Review URL: http://codereview.chromium.org/859003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/options/advanced_page_gtk.cc21
-rw-r--r--chrome/browser/gtk/options/advanced_page_gtk.h7
-rw-r--r--chrome/browser/gtk/options/content_exception_editor.cc44
-rw-r--r--chrome/browser/gtk/options/content_exception_editor.h11
-rw-r--r--chrome/browser/gtk/options/content_exceptions_window_gtk.cc8
-rw-r--r--chrome/browser/gtk/options/content_exceptions_window_gtk.h21
-rw-r--r--chrome/browser/gtk/options/content_filter_page_gtk.cc28
-rw-r--r--chrome/browser/gtk/options/content_filter_page_gtk.h8
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.cc170
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.h59
-rw-r--r--chrome/browser/gtk/options/content_settings_window_gtk.cc20
-rw-r--r--chrome/browser/gtk/options/content_settings_window_gtk.h9
-rw-r--r--chrome/browser/gtk/options/cookie_filter_page_gtk.cc74
-rw-r--r--chrome/browser/gtk/options/cookie_filter_page_gtk.h20
-rw-r--r--chrome/browser/gtk/options/cookies_view.cc91
-rw-r--r--chrome/browser/gtk/options/cookies_view.h36
16 files changed, 243 insertions, 384 deletions
diff --git a/chrome/browser/gtk/options/advanced_page_gtk.cc b/chrome/browser/gtk/options/advanced_page_gtk.cc
index 3440595..c09d27e 100644
--- a/chrome/browser/gtk/options/advanced_page_gtk.cc
+++ b/chrome/browser/gtk/options/advanced_page_gtk.cc
@@ -41,17 +41,15 @@ void AdvancedPageGtk::Init() {
GtkWidget* reset_button = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_OPTIONS_RESET).c_str());
g_signal_connect(reset_button, "clicked",
- G_CALLBACK(OnResetToDefaultsClicked), this);
+ G_CALLBACK(OnResetToDefaultsClickedThunk), this);
gtk_container_add(GTK_CONTAINER(button_box), reset_button);
gtk_box_pack_start(GTK_BOX(page_), button_box, FALSE, FALSE, 0);
}
-// static
-void AdvancedPageGtk::OnResetToDefaultsClicked(
- GtkButton* button, AdvancedPageGtk* advanced_page) {
- advanced_page->UserMetricsRecordAction("Options_ResetToDefaults", NULL);
+void AdvancedPageGtk::OnResetToDefaultsClicked(GtkWidget* button) {
+ UserMetricsRecordAction("Options_ResetToDefaults", NULL);
GtkWidget* dialog_ = gtk_message_dialog_new(
- GTK_WINDOW(gtk_widget_get_toplevel(advanced_page->page_)),
+ GTK_WINDOW(gtk_widget_get_toplevel(page_)),
static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL),
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
@@ -68,16 +66,15 @@ void AdvancedPageGtk::OnResetToDefaultsClicked(
gtk_window_set_title(GTK_WINDOW(dialog_),
l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
g_signal_connect(dialog_, "response",
- G_CALLBACK(OnResetToDefaultsResponse), advanced_page);
+ G_CALLBACK(OnResetToDefaultsResponseThunk), this);
gtk_widget_show_all(dialog_);
}
-// static
-void AdvancedPageGtk::OnResetToDefaultsResponse(
- GtkDialog* dialog, int response_id, AdvancedPageGtk* advanced_page) {
+void AdvancedPageGtk::OnResetToDefaultsResponse(GtkWidget* dialog,
+ int response_id) {
if (response_id == GTK_RESPONSE_OK) {
- OptionsUtil::ResetToDefaults(advanced_page->profile());
+ OptionsUtil::ResetToDefaults(profile());
}
- gtk_widget_destroy(GTK_WIDGET(dialog));
+ gtk_widget_destroy(dialog);
}
diff --git a/chrome/browser/gtk/options/advanced_page_gtk.h b/chrome/browser/gtk/options/advanced_page_gtk.h
index 5ead33c..25c7d51 100644
--- a/chrome/browser/gtk/options/advanced_page_gtk.h
+++ b/chrome/browser/gtk/options/advanced_page_gtk.h
@@ -10,6 +10,7 @@
#include "chrome/browser/gtk/options/advanced_contents_gtk.h"
#include "chrome/browser/options_page_base.h"
#include "chrome/browser/pref_member.h"
+#include "chrome/common/gtk_signal.h"
class Profile;
@@ -26,12 +27,10 @@ class AdvancedPageGtk : public OptionsPageBase {
void Init();
// Callback for reset to default button.
- static void OnResetToDefaultsClicked(GtkButton* button,
- AdvancedPageGtk* advanced_page);
+ CHROMEGTK_CALLBACK_0(AdvancedPageGtk, void, OnResetToDefaultsClicked);
// Callback for reset to default confirmation dialog.
- static void OnResetToDefaultsResponse(GtkDialog* dialog, int response_id,
- AdvancedPageGtk* advanced_page);
+ CHROMEGTK_CALLBACK_1(AdvancedPageGtk, void, OnResetToDefaultsResponse, int);
// The contents of the scroll box.
AdvancedContentsGtk advanced_contents_;
diff --git a/chrome/browser/gtk/options/content_exception_editor.cc b/chrome/browser/gtk/options/content_exception_editor.cc
index e4ee04d..74d29e3 100644
--- a/chrome/browser/gtk/options/content_exception_editor.cc
+++ b/chrome/browser/gtk/options/content_exception_editor.cc
@@ -66,7 +66,7 @@ ContentExceptionEditor::ContentExceptionEditor(
entry_ = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry_), host_.c_str());
- g_signal_connect(entry_, "changed", G_CALLBACK(OnEntryChanged), this);
+ g_signal_connect(entry_, "changed", G_CALLBACK(OnEntryChangedThunk), this);
gtk_entry_set_activates_default(GTK_ENTRY(entry_), TRUE);
host_image_ = gtk_image_new_from_pixbuf(NULL);
@@ -93,12 +93,12 @@ ContentExceptionEditor::ContentExceptionEditor(
gtk_util::kContentAreaSpacing);
// Prime the state of the buttons.
- OnEntryChanged(GTK_EDITABLE(entry_), this);
+ OnEntryChanged(entry_);
gtk_widget_show_all(dialog_);
- g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this);
- g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
+ g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
+ g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this);
}
bool ContentExceptionEditor::IsHostValid(const std::string& host) const {
@@ -115,36 +115,26 @@ void ContentExceptionEditor::UpdateImage(GtkWidget* image, bool is_valid) {
is_valid ? IDR_INPUT_GOOD : IDR_INPUT_ALERT));
}
-// static
-void ContentExceptionEditor::OnEntryChanged(GtkEditable* entry,
- ContentExceptionEditor* window) {
- std::string new_host = gtk_entry_get_text(GTK_ENTRY(window->entry_));
- bool is_valid = window->IsHostValid(new_host);
- gtk_dialog_set_response_sensitive(GTK_DIALOG(window->dialog_),
+void ContentExceptionEditor::OnEntryChanged(GtkWidget* entry) {
+ std::string new_host = gtk_entry_get_text(GTK_ENTRY(entry));
+ bool is_valid = IsHostValid(new_host);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog_),
GTK_RESPONSE_OK, is_valid);
- window->UpdateImage(window->host_image_, is_valid);
+ UpdateImage(host_image_, is_valid);
}
-// static
-void ContentExceptionEditor::OnResponse(
- GtkWidget* sender,
- int response_id,
- ContentExceptionEditor* window) {
+void ContentExceptionEditor::OnResponse(GtkWidget* sender, int response_id) {
if (response_id == GTK_RESPONSE_OK) {
// Notify our delegate to update everything.
- std::string new_host = gtk_entry_get_text(GTK_ENTRY(window->entry_));
- ContentSetting setting = window->cb_model_.SettingForIndex(
- gtk_combo_box_get_active(GTK_COMBO_BOX(window->action_combo_)));
- window->delegate_->AcceptExceptionEdit(new_host, setting, window->index_,
- window->is_new());
+ std::string new_host = gtk_entry_get_text(GTK_ENTRY(entry_));
+ ContentSetting setting = cb_model_.SettingForIndex(
+ gtk_combo_box_get_active(GTK_COMBO_BOX(action_combo_)));
+ delegate_->AcceptExceptionEdit(new_host, setting, index_, is_new());
}
- gtk_widget_destroy(window->dialog_);
+ gtk_widget_destroy(dialog_);
}
-// static
-void ContentExceptionEditor::OnWindowDestroy(
- GtkWidget* widget,
- ContentExceptionEditor* editor) {
- MessageLoop::current()->DeleteSoon(FROM_HERE, editor);
+void ContentExceptionEditor::OnWindowDestroy(GtkWidget* widget) {
+ MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
diff --git a/chrome/browser/gtk/options/content_exception_editor.h b/chrome/browser/gtk/options/content_exception_editor.h
index 8c618b8..0d4b4ff 100644
--- a/chrome/browser/gtk/options/content_exception_editor.h
+++ b/chrome/browser/gtk/options/content_exception_editor.h
@@ -13,6 +13,7 @@
#include "chrome/browser/content_setting_combo_model.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h"
+#include "chrome/common/gtk_signal.h"
// An editor which lets the user create or edit an individual exception to the
// current content setting policy. (i.e. let www.google.com always show
@@ -47,13 +48,9 @@ class ContentExceptionEditor {
void UpdateImage(GtkWidget* image, bool is_valid);
// GTK callbacks
- static void OnEntryChanged(GtkEditable* entry,
- ContentExceptionEditor* window);
- static void OnResponse(GtkWidget* sender,
- int response_id,
- ContentExceptionEditor* window);
- static void OnWindowDestroy(GtkWidget* widget,
- ContentExceptionEditor* editor);
+ CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnEntryChanged);
+ CHROMEGTK_CALLBACK_1(ContentExceptionEditor, void, OnResponse, int);
+ CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnWindowDestroy);
Delegate* delegate_;
ContentExceptionsTableModel* model_;
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc b/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
index cabf064..31c01de 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
+++ b/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
@@ -197,13 +197,13 @@ void ContentExceptionsWindowGtk::UpdateButtonState() {
gtk_widget_set_sensitive(remove_all_button_, row_count > 0);
}
-void ContentExceptionsWindowGtk::Add() {
+void ContentExceptionsWindowGtk::Add(GtkWidget* widget) {
new ContentExceptionEditor(GTK_WINDOW(dialog_),
this, model_.get(), -1, std::string(),
CONTENT_SETTING_BLOCK);
}
-void ContentExceptionsWindowGtk::Edit() {
+void ContentExceptionsWindowGtk::Edit(GtkWidget* widget) {
std::set<int> indices;
gtk_tree::GetSelectedIndicies(treeview_selection_, &indices);
DCHECK_GT(indices.size(), 0u);
@@ -214,7 +214,7 @@ void ContentExceptionsWindowGtk::Edit() {
entry.first, entry.second);
}
-void ContentExceptionsWindowGtk::Remove() {
+void ContentExceptionsWindowGtk::Remove(GtkWidget* widget) {
std::set<int> indices;
gtk_tree::GetSelectedIndicies(treeview_selection_, &indices);
@@ -226,7 +226,7 @@ void ContentExceptionsWindowGtk::Remove() {
UpdateButtonState();
}
-void ContentExceptionsWindowGtk::RemoveAll() {
+void ContentExceptionsWindowGtk::RemoveAll(GtkWidget* widget) {
model_->RemoveAll();
UpdateButtonState();
}
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk.h b/chrome/browser/gtk/options/content_exceptions_window_gtk.h
index 59f0e75..86983ef 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk.h
+++ b/chrome/browser/gtk/options/content_exceptions_window_gtk.h
@@ -15,6 +15,7 @@
#include "chrome/browser/gtk/options/content_exception_editor.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h"
+#include "chrome/common/gtk_signal.h"
class HostContentSettingsMap;
@@ -54,22 +55,10 @@ class ContentExceptionsWindowGtk : public gtk_tree::TableAdapter::Delegate,
void UpdateButtonState();
// Callbacks for the buttons.
- static void AddThunk(GtkButton* unused, gpointer self) {
- reinterpret_cast<ContentExceptionsWindowGtk*>(self)->Add();
- }
- void Add();
- static void EditThunk(GtkButton* unused, gpointer self) {
- reinterpret_cast<ContentExceptionsWindowGtk*>(self)->Edit();
- }
- void Edit();
- static void RemoveThunk(GtkButton* unused, gpointer self) {
- reinterpret_cast<ContentExceptionsWindowGtk*>(self)->Remove();
- }
- void Remove();
- static void RemoveAllThunk(GtkButton* unused, gpointer self) {
- reinterpret_cast<ContentExceptionsWindowGtk*>(self)->RemoveAll();
- }
- void RemoveAll();
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Add);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Edit);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Remove);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, RemoveAll);
// Returns the title of the window (changes based on what ContentSettingsType
// was set to in the constructor).
diff --git a/chrome/browser/gtk/options/content_filter_page_gtk.cc b/chrome/browser/gtk/options/content_filter_page_gtk.cc
index f591356..df87034 100644
--- a/chrome/browser/gtk/options/content_filter_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_filter_page_gtk.cc
@@ -83,14 +83,14 @@ GtkWidget* ContentFilterPageGtk::InitGroup() {
// Now that we've set the default value, we can connect to the radio button's
// toggled signal.
g_signal_connect(G_OBJECT(allow_radio_), "toggled",
- G_CALLBACK(OnAllowToggled), this);
+ G_CALLBACK(OnAllowToggledThunk), this);
g_signal_connect(G_OBJECT(block_radio_), "toggled",
- G_CALLBACK(OnAllowToggled), this);
+ G_CALLBACK(OnAllowToggledThunk), this);
GtkWidget* exceptions_button = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_COOKIES_EXCEPTIONS_BUTTON).c_str());
g_signal_connect(G_OBJECT(exceptions_button), "clicked",
- G_CALLBACK(OnExceptionsClicked), this);
+ G_CALLBACK(OnExceptionsClickedThunk), this);
GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), exceptions_button, FALSE, FALSE, 0);
@@ -99,26 +99,22 @@ GtkWidget* ContentFilterPageGtk::InitGroup() {
return vbox;
}
-void ContentFilterPageGtk::OnAllowToggled(
- GtkWidget* toggle_button,
- ContentFilterPageGtk* content_page) {
- DCHECK((toggle_button == content_page->allow_radio_) ||
- (toggle_button == content_page->block_radio_));
+void ContentFilterPageGtk::OnAllowToggled(GtkWidget* toggle_button) {
+ DCHECK((toggle_button == allow_radio_) ||
+ (toggle_button == block_radio_));
bool allow = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(content_page->allow_radio_));
- content_page->profile()->GetHostContentSettingsMap()->
+ GTK_TOGGLE_BUTTON(allow_radio_));
+ profile()->GetHostContentSettingsMap()->
SetDefaultContentSetting(
- content_page->content_type_,
+ content_type_,
allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
}
-void ContentFilterPageGtk::OnExceptionsClicked(
- GtkWidget* button,
- ContentFilterPageGtk* content_page) {
+void ContentFilterPageGtk::OnExceptionsClicked(GtkWidget* button) {
HostContentSettingsMap* settings_map =
- content_page->profile()->GetHostContentSettingsMap();
+ profile()->GetHostContentSettingsMap();
ContentExceptionsWindowGtk::ShowExceptionsWindow(
GTK_WINDOW(gtk_widget_get_toplevel(button)),
- settings_map, content_page->content_type_);
+ settings_map, content_type_);
}
diff --git a/chrome/browser/gtk/options/content_filter_page_gtk.h b/chrome/browser/gtk/options/content_filter_page_gtk.h
index 48e1fe3..7d83ab5 100644
--- a/chrome/browser/gtk/options/content_filter_page_gtk.h
+++ b/chrome/browser/gtk/options/content_filter_page_gtk.h
@@ -11,6 +11,7 @@
#include "chrome/browser/options_page_base.h"
#include "chrome/common/content_settings_types.h"
+#include "chrome/common/gtk_signal.h"
// A page in the content settings window. Used for everything but the Cookies
// page (which has a much more complex dialog). A |content_type| is passed into
@@ -28,11 +29,8 @@ class ContentFilterPageGtk : public OptionsPageBase {
// Builds the content of the dialog.
GtkWidget* InitGroup();
- // GTK callbacks
- static void OnAllowToggled(GtkWidget* toggle_button,
- ContentFilterPageGtk* content_page);
- static void OnExceptionsClicked(GtkWidget* button,
- ContentFilterPageGtk* content_page);
+ CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnAllowToggled);
+ CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnExceptionsClicked);
ContentSettingsType content_type_;
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc
index 2789195..ed617c0 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_page_gtk.cc
@@ -191,7 +191,7 @@ GtkWidget* ContentPageGtk::InitPasswordSavingGroup() {
passwords_asktosave_radio_ = gtk_radio_button_new_with_label(NULL,
l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_ASKTOSAVE).c_str());
g_signal_connect(passwords_asktosave_radio_, "toggled",
- G_CALLBACK(OnPasswordRadioToggled), this);
+ G_CALLBACK(OnPasswordRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), passwords_asktosave_radio_, FALSE,
FALSE, 0);
@@ -200,7 +200,7 @@ GtkWidget* ContentPageGtk::InitPasswordSavingGroup() {
GTK_RADIO_BUTTON(passwords_asktosave_radio_),
l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_NEVERSAVE).c_str());
g_signal_connect(passwords_neversave_radio_, "toggled",
- G_CALLBACK(OnPasswordRadioToggled), this);
+ G_CALLBACK(OnPasswordRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), passwords_neversave_radio_, FALSE,
FALSE, 0);
@@ -211,7 +211,7 @@ GtkWidget* ContentPageGtk::InitPasswordSavingGroup() {
GtkWidget* show_passwords_button = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS).c_str());
g_signal_connect(show_passwords_button, "clicked",
- G_CALLBACK(OnShowPasswordsButtonClicked), this);
+ G_CALLBACK(OnShowPasswordsButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(button_hbox), show_passwords_button, FALSE,
FALSE, 0);
@@ -225,7 +225,7 @@ GtkWidget* ContentPageGtk::InitFormAutofillGroup() {
form_autofill_enable_radio_ = gtk_radio_button_new_with_label(NULL,
l10n_util::GetStringUTF8(IDS_OPTIONS_AUTOFILL_ENABLE).c_str());
g_signal_connect(G_OBJECT(form_autofill_enable_radio_), "toggled",
- G_CALLBACK(OnAutofillRadioToggled), this);
+ G_CALLBACK(OnAutofillRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), form_autofill_enable_radio_, FALSE,
FALSE, 0);
@@ -234,7 +234,7 @@ GtkWidget* ContentPageGtk::InitFormAutofillGroup() {
GTK_RADIO_BUTTON(form_autofill_enable_radio_),
l10n_util::GetStringUTF8(IDS_OPTIONS_AUTOFILL_DISABLE).c_str());
g_signal_connect(G_OBJECT(form_autofill_disable_radio_), "toggled",
- G_CALLBACK(OnAutofillRadioToggled), this);
+ G_CALLBACK(OnAutofillRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), form_autofill_disable_radio_, FALSE,
FALSE, 0);
@@ -248,7 +248,7 @@ GtkWidget* ContentPageGtk::InitFormAutofillGroup() {
gtk_widget_set_sensitive(autofill_button, FALSE);
g_signal_connect(G_OBJECT(autofill_button), "clicked",
- G_CALLBACK(OnAutoFillButtonClicked), this);
+ G_CALLBACK(OnAutofillButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(button_hbox), autofill_button, FALSE, FALSE, 0);
return vbox;
@@ -261,7 +261,7 @@ GtkWidget* ContentPageGtk::InitBrowsingDataGroup() {
GtkWidget* import_button = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_OPTIONS_IMPORT_DATA_BUTTON).c_str());
g_signal_connect(import_button, "clicked",
- G_CALLBACK(OnImportButtonClicked), this);
+ G_CALLBACK(OnImportButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(button_box), import_button, FALSE, FALSE, 0);
return button_box;
@@ -276,7 +276,7 @@ GtkWidget* ContentPageGtk::InitThemesGroup() {
gtk_theme_button_ = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_THEMES_GTK_BUTTON).c_str());
g_signal_connect(gtk_theme_button_, "clicked",
- G_CALLBACK(OnGtkThemeButtonClicked), this);
+ G_CALLBACK(OnGtkThemeButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(hbox), gtk_theme_button_, FALSE, FALSE, 0);
#endif
@@ -284,14 +284,14 @@ GtkWidget* ContentPageGtk::InitThemesGroup() {
themes_reset_button_ = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_THEMES_SET_CLASSIC).c_str());
g_signal_connect(themes_reset_button_, "clicked",
- G_CALLBACK(OnResetDefaultThemeButtonClicked), this);
+ G_CALLBACK(OnResetDefaultThemeButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(hbox), themes_reset_button_, FALSE, FALSE, 0);
// Get themes button.
GtkWidget* themes_gallery_button = gtk_chrome_link_button_new(
l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_BUTTON).c_str());
g_signal_connect(themes_gallery_button, "clicked",
- G_CALLBACK(OnGetThemesButtonClicked), this);
+ G_CALLBACK(OnGetThemesButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(hbox), themes_gallery_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
@@ -302,7 +302,7 @@ GtkWidget* ContentPageGtk::InitThemesGroup() {
system_title_bar_show_radio_ = gtk_radio_button_new_with_label(NULL,
l10n_util::GetStringUTF8(IDS_SHOW_WINDOW_DECORATIONS_RADIO).c_str());
g_signal_connect(system_title_bar_show_radio_, "toggled",
- G_CALLBACK(OnSystemTitleBarRadioToggled), this);
+ G_CALLBACK(OnSystemTitleBarRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), system_title_bar_show_radio_, FALSE,
FALSE, 0);
@@ -311,7 +311,7 @@ GtkWidget* ContentPageGtk::InitThemesGroup() {
GTK_RADIO_BUTTON(system_title_bar_show_radio_),
l10n_util::GetStringUTF8(IDS_HIDE_WINDOW_DECORATIONS_RADIO).c_str());
g_signal_connect(system_title_bar_hide_radio_, "toggled",
- G_CALLBACK(OnSystemTitleBarRadioToggled), this);
+ G_CALLBACK(OnSystemTitleBarRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), system_title_bar_hide_radio_, FALSE,
FALSE, 0);
}
@@ -339,7 +339,7 @@ GtkWidget* ContentPageGtk::InitSyncGroup() {
sync_action_link_background_ = gtk_event_box_new();
sync_action_link_ = gtk_chrome_link_button_new("");
g_signal_connect(sync_action_link_, "clicked",
- G_CALLBACK(OnSyncActionLinkClicked), this);
+ G_CALLBACK(OnSyncActionLinkClickedThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), link_hbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(link_hbox), sync_action_link_background_, FALSE,
FALSE, 0);
@@ -353,7 +353,7 @@ GtkWidget* ContentPageGtk::InitSyncGroup() {
gtk_container_add(GTK_CONTAINER(vbox), button_hbox);
sync_start_stop_button_ = gtk_button_new_with_label("");
g_signal_connect(sync_start_stop_button_, "clicked",
- G_CALLBACK(OnSyncStartStopButtonClicked), this);
+ G_CALLBACK(OnSyncStartStopButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(button_hbox), sync_start_stop_button_, FALSE,
FALSE, 0);
@@ -402,138 +402,118 @@ void ContentPageGtk::UpdateSyncControls() {
}
}
-// static
-void ContentPageGtk::OnAutoFillButtonClicked(GtkButton* widget,
- ContentPageGtk* page) {
- DCHECK(page->personal_data_);
+void ContentPageGtk::OnAutofillButtonClicked(GtkWidget* widget) {
+ DCHECK(personal_data_);
// If the personal data manager has not loaded the data yet, set ourselves as
// its observer so that we can listen for the OnPersonalDataLoaded signal.
- if (!page->personal_data_->IsDataLoaded())
- page->personal_data_->SetObserver(page);
+ if (!personal_data_->IsDataLoaded())
+ personal_data_->SetObserver(this);
else
- page->OnPersonalDataLoaded();
+ OnPersonalDataLoaded();
}
-// static
-void ContentPageGtk::OnImportButtonClicked(GtkButton* widget,
- ContentPageGtk* page) {
+void ContentPageGtk::OnImportButtonClicked(GtkWidget* widget) {
ImportDialogGtk::Show(
- GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(widget))),
- page->profile(), ALL);
+ GTK_WINDOW(gtk_widget_get_toplevel(widget)),
+ profile(), ALL);
}
-// static
-void ContentPageGtk::OnGtkThemeButtonClicked(GtkButton* widget,
- ContentPageGtk* page) {
- page->UserMetricsRecordAction("Options_GtkThemeSet",
- page->profile()->GetPrefs());
- page->profile()->SetNativeTheme();
+void ContentPageGtk::OnGtkThemeButtonClicked(GtkWidget* widget) {
+ UserMetricsRecordAction("Options_GtkThemeSet",
+ profile()->GetPrefs());
+ profile()->SetNativeTheme();
}
-// static
-void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkButton* widget,
- ContentPageGtk* page) {
- page->UserMetricsRecordAction("Options_ThemesReset",
- page->profile()->GetPrefs());
- page->profile()->ClearTheme();
+void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkWidget* widget) {
+ UserMetricsRecordAction("Options_ThemesReset",
+ profile()->GetPrefs());
+ profile()->ClearTheme();
}
-// static
-void ContentPageGtk::OnGetThemesButtonClicked(GtkButton* widget,
- ContentPageGtk* page) {
- page->UserMetricsRecordAction("Options_ThemesGallery",
- page->profile()->GetPrefs());
+void ContentPageGtk::OnGetThemesButtonClicked(GtkWidget* widget) {
+ UserMetricsRecordAction("Options_ThemesGallery",
+ profile()->GetPrefs());
BrowserList::GetLastActive()->OpenThemeGalleryTabAndActivate();
}
-// static
-void ContentPageGtk::OnSystemTitleBarRadioToggled(GtkToggleButton* widget,
- ContentPageGtk* page) {
+void ContentPageGtk::OnSystemTitleBarRadioToggled(GtkWidget* widget) {
DCHECK(browser_defaults::kCanToggleSystemTitleBar);
- if (page->initializing_)
+ if (initializing_)
return;
// We get two signals when selecting a radio button, one for the old radio
// being toggled off and one for the new one being toggled on. Ignore the
// signal for the toggling off the old button.
- if (!gtk_toggle_button_get_active(widget))
+ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
return;
bool use_custom = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(page->system_title_bar_hide_radio_));
+ GTK_TOGGLE_BUTTON(system_title_bar_hide_radio_));
if (use_custom) {
- page->UserMetricsRecordAction("Options_CustomFrame_Enable",
- page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_CustomFrame_Enable",
+ profile()->GetPrefs());
} else {
- page->UserMetricsRecordAction("Options_CustomFrame_Disable",
- page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_CustomFrame_Disable",
+ profile()->GetPrefs());
}
- page->use_custom_chrome_frame_.SetValue(use_custom);
+ use_custom_chrome_frame_.SetValue(use_custom);
}
-// static
-void ContentPageGtk::OnShowPasswordsButtonClicked(GtkButton* widget,
- ContentPageGtk* page) {
- ShowPasswordsExceptionsWindow(page->profile());
+void ContentPageGtk::OnShowPasswordsButtonClicked(GtkWidget* widget) {
+ ShowPasswordsExceptionsWindow(profile());
}
-// static
-void ContentPageGtk::OnPasswordRadioToggled(GtkToggleButton* widget,
- ContentPageGtk* page) {
- if (page->initializing_)
+void ContentPageGtk::OnPasswordRadioToggled(GtkWidget* widget) {
+ if (initializing_)
return;
// We get two signals when selecting a radio button, one for the old radio
// being toggled off and one for the new one being toggled on. Ignore the
// signal for the toggling off the old button.
- if (!gtk_toggle_button_get_active(widget))
+ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
return;
bool enabled = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(page->passwords_asktosave_radio_));
+ GTK_TOGGLE_BUTTON(passwords_asktosave_radio_));
if (enabled) {
- page->UserMetricsRecordAction("Options_PasswordManager_Enable",
- page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_PasswordManager_Enable",
+ profile()->GetPrefs());
} else {
- page->UserMetricsRecordAction("Options_PasswordManager_Disable",
- page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_PasswordManager_Disable",
+ profile()->GetPrefs());
}
- page->ask_to_save_passwords_.SetValue(enabled);
+ ask_to_save_passwords_.SetValue(enabled);
}
-// static
-void ContentPageGtk::OnAutofillRadioToggled(GtkToggleButton* widget,
- ContentPageGtk* page) {
- if (page->initializing_)
+void ContentPageGtk::OnAutofillRadioToggled(GtkWidget* widget) {
+ if (initializing_)
return;
// We get two signals when selecting a radio button, one for the old radio
// being toggled off and one for the new one being toggled on. Ignore the
// signal for the toggling off the old button.
- if (!gtk_toggle_button_get_active(widget))
+ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
return;
bool enabled = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(page->form_autofill_enable_radio_));
+ GTK_TOGGLE_BUTTON(form_autofill_enable_radio_));
if (enabled) {
- page->UserMetricsRecordAction("Options_FormAutofill_Enable",
- page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_FormAutofill_Enable",
+ profile()->GetPrefs());
} else {
- page->UserMetricsRecordAction("Options_FormAutofill_Disable",
- page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_FormAutofill_Disable",
+ profile()->GetPrefs());
}
- page->enable_form_autofill_.SetValue(enabled);
+ enable_form_autofill_.SetValue(enabled);
}
-// static
-void ContentPageGtk::OnSyncStartStopButtonClicked(GtkButton* widget,
- ContentPageGtk* page) {
- DCHECK(page->sync_service_);
+void ContentPageGtk::OnSyncStartStopButtonClicked(GtkWidget* widget) {
+ DCHECK(sync_service_);
- if (page->sync_service_->HasSyncSetupCompleted()) {
+ if (sync_service_->HasSyncSetupCompleted()) {
GtkWidget* dialog = gtk_message_dialog_new(
- GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(widget))),
+ GTK_WINDOW(gtk_widget_get_toplevel(widget)),
static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL),
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
@@ -554,28 +534,24 @@ void ContentPageGtk::OnSyncStartStopButtonClicked(GtkButton* widget,
NULL);
g_signal_connect(dialog, "response",
- G_CALLBACK(OnStopSyncDialogResponse), page);
+ G_CALLBACK(OnStopSyncDialogResponseThunk), this);
gtk_widget_show_all(dialog);
return;
} else {
- page->sync_service_->EnableForUser();
+ sync_service_->EnableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS);
}
}
-// static
-void ContentPageGtk::OnSyncActionLinkClicked(GtkButton* widget,
- ContentPageGtk* page) {
- DCHECK(page->sync_service_);
- page->sync_service_->ShowLoginDialog();
+void ContentPageGtk::OnSyncActionLinkClicked(GtkWidget* widget) {
+ DCHECK(sync_service_);
+ sync_service_->ShowLoginDialog();
}
-// static
-void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response,
- ContentPageGtk* page) {
+void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) {
if (response == GTK_RESPONSE_ACCEPT) {
- page->sync_service_->DisableForUser();
+ sync_service_->DisableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
}
gtk_widget_destroy(widget);
diff --git a/chrome/browser/gtk/options/content_page_gtk.h b/chrome/browser/gtk/options/content_page_gtk.h
index 8552ec0..2523efd 100644
--- a/chrome/browser/gtk/options/content_page_gtk.h
+++ b/chrome/browser/gtk/options/content_page_gtk.h
@@ -12,6 +12,7 @@
#include "chrome/browser/pref_member.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/common/gtk_signal.h"
class ContentPageGtk : public OptionsPageBase,
public ProfileSyncServiceObserver,
@@ -52,52 +53,18 @@ class ContentPageGtk : public OptionsPageBase,
GtkWidget* InitThemesGroup();
GtkWidget* InitSyncGroup();
- // Callback for autofill button.
- static void OnAutoFillButtonClicked(GtkButton* widget, ContentPageGtk* page);
-
- // Callback for import button.
- static void OnImportButtonClicked(GtkButton* widget, ContentPageGtk* page);
-
- // Callback for the GTK theme button.
- static void OnGtkThemeButtonClicked(GtkButton* widget,
- ContentPageGtk* page);
-
- // Callback for reset default theme button.
- static void OnResetDefaultThemeButtonClicked(GtkButton* widget,
- ContentPageGtk* page);
-
- // Callback for get themes button.
- static void OnGetThemesButtonClicked(GtkButton* widget,
- ContentPageGtk* page);
-
- // Callback for system title bar radio buttons.
- static void OnSystemTitleBarRadioToggled(GtkToggleButton* widget,
- ContentPageGtk* page);
-
- // Callback for show passwords button.
- static void OnShowPasswordsButtonClicked(GtkButton* widget,
- ContentPageGtk* page);
-
- // Callback for password radio buttons.
- static void OnPasswordRadioToggled(GtkToggleButton* widget,
- ContentPageGtk* page);
-
- // Callback for form autofill radio buttons.
- static void OnAutofillRadioToggled(GtkToggleButton* widget,
- ContentPageGtk* page);
-
- // Callback for sync start/stop button.
- static void OnSyncStartStopButtonClicked(GtkButton* widget,
- ContentPageGtk* page);
-
- // Callback for sync action link.
- static void OnSyncActionLinkClicked(GtkButton* widget,
- ContentPageGtk* page);
-
- // Callback for stop sync dialog.
- static void OnStopSyncDialogResponse(GtkWidget* widget,
- int response,
- ContentPageGtk* page);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnImportButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnGtkThemeButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnResetDefaultThemeButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnGetThemesButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSystemTitleBarRadioToggled);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnShowPasswordsButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnPasswordRadioToggled);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutofillButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutofillRadioToggled);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncStartStopButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncActionLinkClicked);
+ CHROMEGTK_CALLBACK_1(ContentPageGtk, void, OnStopSyncDialogResponse, int);
// Widgets for the Password saving group.
GtkWidget* passwords_asktosave_radio_;
diff --git a/chrome/browser/gtk/options/content_settings_window_gtk.cc b/chrome/browser/gtk/options/content_settings_window_gtk.cc
index ab0b420..7e50a7c 100644
--- a/chrome/browser/gtk/options/content_settings_window_gtk.cc
+++ b/chrome/browser/gtk/options/content_settings_window_gtk.cc
@@ -122,13 +122,14 @@ ContentSettingsWindowGtk::ContentSettingsWindowGtk(GtkWindow* parent,
// last_selected_page_ value.
gtk_widget_show_all(dialog_);
- g_signal_connect(notebook_, "switch-page", G_CALLBACK(OnSwitchPage), this);
+ g_signal_connect(notebook_, "switch-page",
+ G_CALLBACK(OnSwitchPageThunk), this);
// We only have one button and don't do any special handling, so just hook it
// directly to gtk_widget_destroy.
g_signal_connect(dialog_, "response", G_CALLBACK(gtk_widget_destroy), NULL);
- g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
+ g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this);
}
ContentSettingsWindowGtk::~ContentSettingsWindowGtk() {
@@ -159,22 +160,17 @@ void ContentSettingsWindowGtk::ShowContentSettingsTab(
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_), page);
}
-// static
void ContentSettingsWindowGtk::OnSwitchPage(
- GtkNotebook* notebook,
+ GtkWidget* notebook,
GtkNotebookPage* page,
- guint page_num,
- ContentSettingsWindowGtk* window) {
+ guint page_num) {
int index = page_num;
DCHECK(index > CONTENT_SETTINGS_TYPE_DEFAULT &&
index < CONTENT_SETTINGS_NUM_TYPES);
- window->last_selected_page_.SetValue(index);
+ last_selected_page_.SetValue(index);
}
-// static
-void ContentSettingsWindowGtk::OnWindowDestroy(
- GtkWidget* widget,
- ContentSettingsWindowGtk* window) {
+void ContentSettingsWindowGtk::OnWindowDestroy(GtkWidget* widget) {
settings_window = NULL;
- MessageLoop::current()->DeleteSoon(FROM_HERE, window);
+ MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
diff --git a/chrome/browser/gtk/options/content_settings_window_gtk.h b/chrome/browser/gtk/options/content_settings_window_gtk.h
index 554aef5..36eede6 100644
--- a/chrome/browser/gtk/options/content_settings_window_gtk.h
+++ b/chrome/browser/gtk/options/content_settings_window_gtk.h
@@ -12,6 +12,7 @@
#include "chrome/browser/gtk/options/content_filter_page_gtk.h"
#include "chrome/browser/pref_member.h"
#include "chrome/common/content_settings_types.h"
+#include "chrome/common/gtk_signal.h"
class AccessibleWidgetHelper;
@@ -32,11 +33,9 @@ class ContentSettingsWindowGtk {
// Shows the Tab corresponding to the specified Content Settings page.
void ShowContentSettingsTab(ContentSettingsType page);
- // GTK callbacks
- static void OnSwitchPage(GtkNotebook* notebook, GtkNotebookPage* page,
- guint page_num, ContentSettingsWindowGtk* window);
- static void OnWindowDestroy(GtkWidget* widget,
- ContentSettingsWindowGtk* window);
+ CHROMEGTK_CALLBACK_2(ContentSettingsWindowGtk, void, OnSwitchPage,
+ GtkNotebookPage*, guint);
+ CHROMEGTK_CALLBACK_0(ContentSettingsWindowGtk, void, OnWindowDestroy);
// The options dialog.
GtkWidget* dialog_;
diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc
index db925d7..512dd22 100644
--- a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc
+++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc
@@ -70,21 +70,21 @@ GtkWidget* CookieFilterPageGtk::InitCookieStoringGroup() {
allow_radio_ = gtk_radio_button_new_with_label(NULL,
l10n_util::GetStringUTF8(IDS_COOKIES_ALLOW_RADIO).c_str());
g_signal_connect(G_OBJECT(allow_radio_), "toggled",
- G_CALLBACK(OnCookiesAllowToggled), this);
+ G_CALLBACK(OnCookiesAllowToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), allow_radio_, FALSE, FALSE, 0);
ask_every_time_radio_ = gtk_radio_button_new_with_label_from_widget(
GTK_RADIO_BUTTON(allow_radio_),
l10n_util::GetStringUTF8(IDS_COOKIES_ASK_EVERY_TIME_RADIO).c_str());
g_signal_connect(G_OBJECT(ask_every_time_radio_), "toggled",
- G_CALLBACK(OnCookiesAllowToggled), this);
+ G_CALLBACK(OnCookiesAllowToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), ask_every_time_radio_, FALSE, FALSE, 0);
block_radio_ = gtk_radio_button_new_with_label_from_widget(
GTK_RADIO_BUTTON(allow_radio_),
l10n_util::GetStringUTF8(IDS_COOKIES_BLOCK_RADIO).c_str());
g_signal_connect(G_OBJECT(block_radio_), "toggled",
- G_CALLBACK(OnCookiesAllowToggled), this);
+ G_CALLBACK(OnCookiesAllowToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), block_radio_, FALSE, FALSE, 0);
// Set up the current value for the button.
@@ -109,7 +109,7 @@ GtkWidget* CookieFilterPageGtk::InitCookieStoringGroup() {
GtkWidget* exceptions_button = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_COOKIES_EXCEPTIONS_BUTTON).c_str());
g_signal_connect(G_OBJECT(exceptions_button), "clicked",
- G_CALLBACK(OnExceptionsClicked), this);
+ G_CALLBACK(OnExceptionsClickedThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), WrapInHBox(exceptions_button),
FALSE, FALSE, 0);
@@ -118,36 +118,34 @@ GtkWidget* CookieFilterPageGtk::InitCookieStoringGroup() {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(block_3rdparty_check_),
settings_map->BlockThirdPartyCookies());
g_signal_connect(G_OBJECT(block_3rdparty_check_), "toggled",
- G_CALLBACK(OnBlock3rdpartyToggled), this);
+ G_CALLBACK(OnBlockThirdPartyToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), block_3rdparty_check_, FALSE, FALSE, 0);
clear_on_close_check_ = gtk_check_button_new_with_label(
l10n_util::GetStringUTF8(IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX).c_str());
g_signal_connect(G_OBJECT(clear_on_close_check_), "toggled",
- G_CALLBACK(OnClearOnCloseToggled), this);
+ G_CALLBACK(OnClearOnCloseToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), clear_on_close_check_, FALSE, FALSE, 0);
show_cookies_button_ = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_COOKIES_SHOW_COOKIES_BUTTON).c_str());
g_signal_connect(G_OBJECT(show_cookies_button_), "clicked",
- G_CALLBACK(OnShowCookiesClicked), this);
+ G_CALLBACK(OnShowCookiesClickedThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), WrapInHBox(show_cookies_button_),
FALSE, FALSE, 0);
GtkWidget* flash_settings_link = gtk_chrome_link_button_new(
l10n_util::GetStringUTF8(IDS_FLASH_STORAGE_SETTINGS).c_str());
g_signal_connect(G_OBJECT(flash_settings_link), "clicked",
- G_CALLBACK(OnFlashLinkClicked), this);
+ G_CALLBACK(OnFlashLinkClickedThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), WrapInHBox(flash_settings_link),
FALSE, FALSE, 0);
return vbox;
};
-void CookieFilterPageGtk::OnCookiesAllowToggled(
- GtkWidget* toggle_button,
- CookieFilterPageGtk* cookie_page) {
- if (cookie_page->initializing_)
+void CookieFilterPageGtk::OnCookiesAllowToggled(GtkWidget* toggle_button) {
+ if (initializing_)
return;
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button))) {
@@ -158,69 +156,57 @@ void CookieFilterPageGtk::OnCookiesAllowToggled(
}
ContentSetting setting = CONTENT_SETTING_ALLOW;
- if (toggle_button == cookie_page->allow_radio_)
+ if (toggle_button == allow_radio_)
setting = CONTENT_SETTING_ALLOW;
- else if (toggle_button == cookie_page->ask_every_time_radio_)
+ else if (toggle_button == ask_every_time_radio_)
setting = CONTENT_SETTING_ASK;
- else if (toggle_button == cookie_page->block_radio_)
+ else if (toggle_button == block_radio_)
setting = CONTENT_SETTING_BLOCK;
- cookie_page->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
+ profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_COOKIES, setting);
}
-void CookieFilterPageGtk::OnExceptionsClicked(
- GtkWidget* button,
- CookieFilterPageGtk* cookie_page) {
- HostContentSettingsMap* settings_map =
- cookie_page->profile()->GetHostContentSettingsMap();
+void CookieFilterPageGtk::OnExceptionsClicked(GtkWidget* button) {
+ HostContentSettingsMap* settings_map = profile()->GetHostContentSettingsMap();
ContentExceptionsWindowGtk::ShowExceptionsWindow(
GTK_WINDOW(gtk_widget_get_toplevel(button)),
settings_map, CONTENT_SETTINGS_TYPE_COOKIES);
}
-void CookieFilterPageGtk::OnBlock3rdpartyToggled(
- GtkToggleButton* toggle_button,
- CookieFilterPageGtk* cookie_page) {
- if (cookie_page->initializing_)
+void CookieFilterPageGtk::OnBlockThirdPartyToggled(GtkWidget* toggle_button) {
+ if (initializing_)
return;
- HostContentSettingsMap* settings_map =
- cookie_page->profile()->GetHostContentSettingsMap();
+ HostContentSettingsMap* settings_map = profile()->GetHostContentSettingsMap();
settings_map->SetBlockThirdPartyCookies(
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
}
-void CookieFilterPageGtk::OnClearOnCloseToggled(
- GtkToggleButton* toggle_button,
- CookieFilterPageGtk* cookie_page) {
- if (cookie_page->initializing_)
+void CookieFilterPageGtk::OnClearOnCloseToggled(GtkWidget* toggle_button) {
+ if (initializing_)
return;
- cookie_page->clear_site_data_on_exit_.SetValue(
+ clear_site_data_on_exit_.SetValue(
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
}
-void CookieFilterPageGtk::OnShowCookiesClicked(
- GtkWidget* button,
- CookieFilterPageGtk* cookie_page) {
- cookie_page->UserMetricsRecordAction("Options_ShowCookies", NULL);
+void CookieFilterPageGtk::OnShowCookiesClicked(GtkWidget* button) {
+ UserMetricsRecordAction("Options_ShowCookies", NULL);
CookiesView::Show(GTK_WINDOW(gtk_widget_get_toplevel(button)),
- cookie_page->profile(),
+ profile(),
new BrowsingDataDatabaseHelper(
- cookie_page->profile()),
+ profile()),
new BrowsingDataLocalStorageHelper(
- cookie_page->profile()),
+ profile()),
new BrowsingDataAppCacheHelper(
- cookie_page->profile()));
+ profile()));
}
-void CookieFilterPageGtk::OnFlashLinkClicked(
- GtkWidget* button,
- CookieFilterPageGtk* cookie_page) {
+void CookieFilterPageGtk::OnFlashLinkClicked(GtkWidget* button) {
// We open a new browser window so the Options dialog doesn't get lost
// behind other windows.
- Browser* browser = Browser::Create(cookie_page->profile());
+ Browser* browser = Browser::Create(profile());
browser->OpenURL(GURL(l10n_util::GetStringUTF8(IDS_FLASH_STORAGE_URL)),
GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
browser->window()->Show();
diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.h b/chrome/browser/gtk/options/cookie_filter_page_gtk.h
index 6c554c2..8d957f5 100644
--- a/chrome/browser/gtk/options/cookie_filter_page_gtk.h
+++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.h
@@ -11,6 +11,7 @@
#include "chrome/browser/options_page_base.h"
#include "chrome/browser/pref_member.h"
+#include "chrome/common/gtk_signal.h"
class Profile;
@@ -31,19 +32,12 @@ class CookieFilterPageGtk : public OptionsPageBase {
virtual void NotifyPrefChanged(const std::wstring* pref_name);
virtual void HighlightGroup(OptionsGroup highlight_group);
- // GTK callbacks
- static void OnCookiesAllowToggled(GtkWidget* toggle_button,
- CookieFilterPageGtk* cookie_page);
- static void OnExceptionsClicked(GtkWidget* toggle_button,
- CookieFilterPageGtk* cookie_page);
- static void OnBlock3rdpartyToggled(GtkToggleButton* toggle_button,
- CookieFilterPageGtk* cookie_page);
- static void OnClearOnCloseToggled(GtkToggleButton* toggle_button,
- CookieFilterPageGtk* cookie_page);
- static void OnShowCookiesClicked(GtkWidget* button,
- CookieFilterPageGtk* cookie_page);
- static void OnFlashLinkClicked(GtkWidget* button,
- CookieFilterPageGtk* cookie_page);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnCookiesAllowToggled);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnExceptionsClicked);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnBlockThirdPartyToggled);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnClearOnCloseToggled);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnShowCookiesClicked);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnFlashLinkClicked);
GtkWidget* InitCookieStoringGroup();
diff --git a/chrome/browser/gtk/options/cookies_view.cc b/chrome/browser/gtk/options/cookies_view.cc
index 2535f6d..bf34b70 100644
--- a/chrome/browser/gtk/options/cookies_view.cc
+++ b/chrome/browser/gtk/options/cookies_view.cc
@@ -129,24 +129,24 @@ void CookiesView::Init(GtkWindow* parent) {
kDialogDefaultHeight);
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
gtk_util::kContentAreaSpacing);
- g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this);
- destroy_handler_ =
- g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
+ g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
+ destroy_handler_ = g_signal_connect(dialog_, "destroy",
+ G_CALLBACK(OnWindowDestroyThunk), this);
// Filtering controls.
GtkWidget* filter_hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing);
filter_entry_ = gtk_entry_new();
g_signal_connect(filter_entry_, "activate",
- G_CALLBACK(OnFilterEntryActivated), this);
+ G_CALLBACK(OnFilterEntryActivatedThunk), this);
g_signal_connect(filter_entry_, "changed",
- G_CALLBACK(OnFilterEntryChanged), this);
+ G_CALLBACK(OnFilterEntryChangedThunk), this);
gtk_box_pack_start(GTK_BOX(filter_hbox), filter_entry_,
TRUE, TRUE, 0);
filter_clear_button_ = gtk_button_new_with_mnemonic(
gtk_util::ConvertAcceleratorsFromWindowsStyle(
l10n_util::GetStringUTF8(IDS_COOKIES_CLEAR_SEARCH_LABEL)).c_str());
g_signal_connect(filter_clear_button_, "clicked",
- G_CALLBACK(OnFilterClearButtonClicked), this);
+ G_CALLBACK(OnFilterClearButtonClickedThunk), this);
gtk_box_pack_start(GTK_BOX(filter_hbox), filter_clear_button_,
FALSE, FALSE, 0);
@@ -201,14 +201,14 @@ void CookiesView::Init(GtkWindow* parent) {
IDS_COOKIES_DOMAIN_COLUMN_HEADER).c_str());
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_), title_column);
g_signal_connect(tree_, "key-press-event",
- G_CALLBACK(OnTreeViewKeyPress), this);
+ G_CALLBACK(OnTreeViewKeyPressThunk), this);
g_signal_connect(tree_, "row-expanded",
- G_CALLBACK(OnTreeViewRowExpanded), this);
+ G_CALLBACK(OnTreeViewRowExpandedThunk), this);
selection_ = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_));
gtk_tree_selection_set_mode(selection_, GTK_SELECTION_SINGLE);
g_signal_connect(selection_, "changed",
- G_CALLBACK(OnSelectionChanged), this);
+ G_CALLBACK(OnTreeViewSelectionChangeThunk), this);
cookie_display_ = gtk_chrome_cookie_view_new();
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
@@ -295,64 +295,54 @@ void CookiesView::RemoveSelectedItems() {
void CookiesView::OnAnyModelUpdateStart() {
g_signal_handlers_block_by_func(
- G_OBJECT(selection_), reinterpret_cast<gpointer>(OnSelectionChanged),
+ selection_, reinterpret_cast<gpointer>(OnTreeViewSelectionChangeThunk),
this);
}
void CookiesView::OnAnyModelUpdate() {
g_signal_handlers_unblock_by_func(
- G_OBJECT(selection_), reinterpret_cast<gpointer>(OnSelectionChanged),
+ selection_, reinterpret_cast<gpointer>(OnTreeViewSelectionChangeThunk),
this);
EnableControls();
}
-// static
-void CookiesView::OnResponse(GtkDialog* dialog, int response_id,
- CookiesView* window) {
+void CookiesView::OnResponse(GtkWidget* dialog, int response_id) {
if (response_id == RESPONSE_REMOVE) {
- window->RemoveSelectedItems();
+ RemoveSelectedItems();
} else if (response_id == RESPONSE_REMOVE_ALL) {
- window->cookies_tree_model_->DeleteAllStoredObjects();
+ cookies_tree_model_->DeleteAllStoredObjects();
} else {
- gtk_widget_destroy(window->dialog_);
+ gtk_widget_destroy(dialog);
}
}
-// static
-void CookiesView::OnWindowDestroy(GtkWidget* widget, CookiesView* window) {
+void CookiesView::OnWindowDestroy(GtkWidget* widget) {
instance_ = NULL;
- MessageLoop::current()->DeleteSoon(FROM_HERE, window);
+ MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
-// static
-void CookiesView::OnSelectionChanged(GtkTreeSelection *selection,
- CookiesView* window) {
- window->EnableControls();
+void CookiesView::OnTreeViewSelectionChange(GtkWidget* selection) {
+ EnableControls();
}
-// static
-gboolean CookiesView::OnTreeViewKeyPress(
- GtkWidget* tree_view, GdkEventKey* key, CookiesView* window) {
+gboolean CookiesView::OnTreeViewKeyPress(GtkWidget* tree_view,
+ GdkEventKey* key) {
if (key->keyval == GDK_Delete) {
- window->RemoveSelectedItems();
+ RemoveSelectedItems();
return TRUE;
}
return FALSE;
}
-// static
-void CookiesView::OnTreeViewRowExpanded(GtkTreeView* tree_view,
+void CookiesView::OnTreeViewRowExpanded(GtkWidget* tree_view,
GtkTreeIter* iter,
- GtkTreePath* path,
- gpointer user_data) {
+ GtkTreePath* path) {
// When a row in the tree is expanded, expand all the children too.
g_signal_handlers_block_by_func(
- G_OBJECT(tree_view), reinterpret_cast<gpointer>(OnTreeViewRowExpanded),
- user_data);
- gtk_tree_view_expand_row(tree_view, path, TRUE);
+ tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this);
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE);
g_signal_handlers_unblock_by_func(
- G_OBJECT(tree_view), reinterpret_cast<gpointer>(OnTreeViewRowExpanded),
- user_data);
+ tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this);
}
void CookiesView::UpdateFilterResults() {
@@ -363,26 +353,21 @@ void CookiesView::UpdateFilterResults() {
}
}
-// static
-void CookiesView::OnFilterEntryActivated(GtkEntry* entry, CookiesView* window) {
- window->filter_update_factory_.RevokeAll();
- window->UpdateFilterResults();
+void CookiesView::OnFilterEntryActivated(GtkWidget* entry) {
+ filter_update_factory_.RevokeAll();
+ UpdateFilterResults();
}
-// static
-void CookiesView::OnFilterEntryChanged(GtkEditable* editable,
- CookiesView* window) {
- window->filter_update_factory_.RevokeAll();
+void CookiesView::OnFilterEntryChanged(GtkWidget* editable) {
+ filter_update_factory_.RevokeAll();
MessageLoop::current()->PostDelayedTask(FROM_HERE,
- window->filter_update_factory_.NewRunnableMethod(
+ filter_update_factory_.NewRunnableMethod(
&CookiesView::UpdateFilterResults), kSearchFilterDelayMs);
- window->EnableControls();
+ EnableControls();
}
-// static
-void CookiesView::OnFilterClearButtonClicked(GtkButton* button,
- CookiesView* window) {
- gtk_entry_set_text(GTK_ENTRY(window->filter_entry_), "");
- window->filter_update_factory_.RevokeAll();
- window->UpdateFilterResults();
+void CookiesView::OnFilterClearButtonClicked(GtkWidget* button) {
+ gtk_entry_set_text(GTK_ENTRY(filter_entry_), "");
+ filter_update_factory_.RevokeAll();
+ UpdateFilterResults();
}
diff --git a/chrome/browser/gtk/options/cookies_view.h b/chrome/browser/gtk/options/cookies_view.h
index 7ba0ee829..7341d2b 100644
--- a/chrome/browser/gtk/options/cookies_view.h
+++ b/chrome/browser/gtk/options/cookies_view.h
@@ -17,6 +17,7 @@
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "chrome/browser/gtk/gtk_chrome_cookie_view.h"
#include "chrome/browser/gtk/gtk_tree.h"
+#include "chrome/common/gtk_signal.h"
#include "net/base/cookie_monster.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
@@ -71,33 +72,22 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate {
// Remove any cookies that are currently selected.
void RemoveSelectedItems();
- // Callback for dialog buttons.
- static void OnResponse(GtkDialog* dialog, int response_id,
- CookiesView* window);
-
- // Callback for window destruction.
- static void OnWindowDestroy(GtkWidget* widget, CookiesView* window);
-
- // Callback for when user selects something in the table.
- static void OnSelectionChanged(GtkTreeSelection *selection,
- CookiesView* window);
-
- // Callback for when user presses a key with the table focused.
- static gboolean OnTreeViewKeyPress(GtkWidget* tree_view, GdkEventKey* key,
- CookiesView* window);
-
- // Callback when user expands a row in the table.
- static void OnTreeViewRowExpanded(GtkTreeView* tree_view, GtkTreeIter* iter,
- GtkTreePath* path, gpointer user_data);
+ CHROMEGTK_CALLBACK_1(CookiesView, void, OnResponse, int);
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnWindowDestroy);
+ // Callback for the table.
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnTreeViewSelectionChange);
+ CHROMEGTK_CALLBACK_1(CookiesView, gboolean, OnTreeViewKeyPress,
+ GdkEventKey*);
+ CHROMEGTK_CALLBACK_2(CookiesView, void, OnTreeViewRowExpanded,
+ GtkTreeIter*, GtkTreePath*);
+ // Callbacks for user actions filtering the list.
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterEntryActivated);
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterEntryChanged);
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterClearButtonClicked);
// Filter the list against the text in |filter_entry_|.
void UpdateFilterResults();
- // Callbacks for user actions filtering the list.
- static void OnFilterEntryActivated(GtkEntry* entry, CookiesView* window);
- static void OnFilterEntryChanged(GtkEditable* editable, CookiesView* window);
- static void OnFilterClearButtonClicked(GtkButton* button,
- CookiesView* window);
// The parent widget.
GtkWidget* dialog_;