| 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/options/content_page_gtk.h" | 5 #include "chrome/browser/gtk/options/content_page_gtk.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/gfx/gtk_util.h" | 9 #include "base/gfx/gtk_util.h" |
| 10 #include "chrome/browser/browser_list.h" |
| 10 #include "chrome/browser/gtk/clear_browsing_data_dialog_gtk.h" | 11 #include "chrome/browser/gtk/clear_browsing_data_dialog_gtk.h" |
| 11 #include "chrome/browser/gtk/import_dialog_gtk.h" | 12 #include "chrome/browser/gtk/import_dialog_gtk.h" |
| 12 #include "chrome/browser/gtk/options/options_layout_gtk.h" | 13 #include "chrome/browser/gtk/options/options_layout_gtk.h" |
| 13 #include "chrome/browser/gtk/options/passwords_exceptions_window_gtk.h" | 14 #include "chrome/browser/gtk/options/passwords_exceptions_window_gtk.h" |
| 14 #include "chrome/common/gtk_util.h" | 15 #include "chrome/common/gtk_util.h" |
| 15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/common/pref_service.h" | 17 #include "chrome/common/pref_service.h" |
| 17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 18 #include "grit/app_resources.h" | 19 #include "grit/app_resources.h" |
| 19 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 22 #include "grit/locale_settings.h" |
| 21 | 23 |
| 22 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
| 23 // ContentPageGtk, public: | 25 // ContentPageGtk, public: |
| 24 | 26 |
| 25 ContentPageGtk::ContentPageGtk(Profile* profile) | 27 ContentPageGtk::ContentPageGtk(Profile* profile) |
| 26 : OptionsPageBase(profile), | 28 : OptionsPageBase(profile), |
| 27 initializing_(true) { | 29 initializing_(true) { |
| 28 | 30 |
| 29 // Prepare the group options layout. | 31 // Prepare the group options layout. |
| 30 OptionsLayoutBuilderGtk options_builder; | 32 OptionsLayoutBuilderGtk options_builder; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 GtkWidget* ContentPageGtk::InitThemesGroup() { | 174 GtkWidget* ContentPageGtk::InitThemesGroup() { |
| 173 GtkWidget* hbox = gtk_hbox_new(FALSE, GtkUtil::kLabelSpacing); | 175 GtkWidget* hbox = gtk_hbox_new(FALSE, GtkUtil::kLabelSpacing); |
| 174 | 176 |
| 175 // GTK theme button. | 177 // GTK theme button. |
| 176 GtkWidget* gtk_theme_button = gtk_button_new_with_label( | 178 GtkWidget* gtk_theme_button = gtk_button_new_with_label( |
| 177 l10n_util::GetStringUTF8(IDS_THEMES_GTK_BUTTON).c_str()); | 179 l10n_util::GetStringUTF8(IDS_THEMES_GTK_BUTTON).c_str()); |
| 178 g_signal_connect(G_OBJECT(gtk_theme_button), "clicked", | 180 g_signal_connect(G_OBJECT(gtk_theme_button), "clicked", |
| 179 G_CALLBACK(OnGtkThemeButtonClicked), this); | 181 G_CALLBACK(OnGtkThemeButtonClicked), this); |
| 180 gtk_box_pack_start(GTK_BOX(hbox), gtk_theme_button, FALSE, FALSE, 0); | 182 gtk_box_pack_start(GTK_BOX(hbox), gtk_theme_button, FALSE, FALSE, 0); |
| 181 | 183 |
| 182 // Reset themes button. | 184 // Reset theme button. |
| 183 GtkWidget* themes_reset_button = gtk_button_new_with_label( | 185 GtkWidget* themes_reset_button = gtk_button_new_with_label( |
| 184 l10n_util::GetStringUTF8(IDS_THEMES_RESET_BUTTON).c_str()); | 186 l10n_util::GetStringUTF8(IDS_THEMES_RESET_BUTTON).c_str()); |
| 185 g_signal_connect(G_OBJECT(themes_reset_button), "clicked", | 187 g_signal_connect(G_OBJECT(themes_reset_button), "clicked", |
| 186 G_CALLBACK(OnResetDefaultThemeButtonClicked), this); | 188 G_CALLBACK(OnResetDefaultThemeButtonClicked), this); |
| 187 gtk_box_pack_start(GTK_BOX(hbox), themes_reset_button, FALSE, FALSE, 0); | 189 gtk_box_pack_start(GTK_BOX(hbox), themes_reset_button, FALSE, FALSE, 0); |
| 188 | 190 |
| 191 // Get themes button. |
| 192 GtkWidget* themes_gallery_button = gtk_button_new_with_label( |
| 193 l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_BUTTON).c_str()); |
| 194 g_signal_connect(G_OBJECT(themes_gallery_button), "clicked", |
| 195 G_CALLBACK(OnGetThemesButtonClicked), this); |
| 196 gtk_box_pack_start(GTK_BOX(hbox), themes_gallery_button, FALSE, FALSE, 0); |
| 197 |
| 189 return hbox; | 198 return hbox; |
| 190 } | 199 } |
| 191 | 200 |
| 192 // static | 201 // static |
| 193 void ContentPageGtk::OnImportButtonClicked(GtkButton* widget, | 202 void ContentPageGtk::OnImportButtonClicked(GtkButton* widget, |
| 194 ContentPageGtk* page) { | 203 ContentPageGtk* page) { |
| 195 ImportDialogGtk::Show( | 204 ImportDialogGtk::Show( |
| 196 GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(widget))), | 205 GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(widget))), |
| 197 page->profile()); | 206 page->profile()); |
| 198 } | 207 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 215 | 224 |
| 216 // static | 225 // static |
| 217 void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkButton* widget, | 226 void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkButton* widget, |
| 218 ContentPageGtk* page) { | 227 ContentPageGtk* page) { |
| 219 page->UserMetricsRecordAction(L"Options_ThemesReset", | 228 page->UserMetricsRecordAction(L"Options_ThemesReset", |
| 220 page->profile()->GetPrefs()); | 229 page->profile()->GetPrefs()); |
| 221 page->profile()->ClearTheme(); | 230 page->profile()->ClearTheme(); |
| 222 } | 231 } |
| 223 | 232 |
| 224 // static | 233 // static |
| 234 void ContentPageGtk::OnGetThemesButtonClicked(GtkButton* widget, |
| 235 ContentPageGtk* page) { |
| 236 page->UserMetricsRecordAction(L"Options_ThemesGallery", |
| 237 page->profile()->GetPrefs()); |
| 238 BrowserList::GetLastActive()->OpenURL( |
| 239 GURL(l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_URL)), |
| 240 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 241 } |
| 242 |
| 243 // static |
| 225 void ContentPageGtk::OnPasswordsExceptionsButtonClicked(GtkButton* widget, | 244 void ContentPageGtk::OnPasswordsExceptionsButtonClicked(GtkButton* widget, |
| 226 ContentPageGtk* page) { | 245 ContentPageGtk* page) { |
| 227 ShowPasswordsExceptionsWindow(page->profile()); | 246 ShowPasswordsExceptionsWindow(page->profile()); |
| 228 } | 247 } |
| 229 | 248 |
| 230 // static | 249 // static |
| 231 void ContentPageGtk::OnPasswordRadioToggled(GtkToggleButton* widget, | 250 void ContentPageGtk::OnPasswordRadioToggled(GtkToggleButton* widget, |
| 232 ContentPageGtk* page) { | 251 ContentPageGtk* page) { |
| 233 if (page->initializing_) | 252 if (page->initializing_) |
| 234 return; | 253 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 GTK_TOGGLE_BUTTON(page->form_autofill_asktosave_radio_)); | 286 GTK_TOGGLE_BUTTON(page->form_autofill_asktosave_radio_)); |
| 268 if (enabled) { | 287 if (enabled) { |
| 269 page->UserMetricsRecordAction(L"Options_FormAutofill_Enable", | 288 page->UserMetricsRecordAction(L"Options_FormAutofill_Enable", |
| 270 page->profile()->GetPrefs()); | 289 page->profile()->GetPrefs()); |
| 271 } else { | 290 } else { |
| 272 page->UserMetricsRecordAction(L"Options_FormAutofill_Disable", | 291 page->UserMetricsRecordAction(L"Options_FormAutofill_Disable", |
| 273 page->profile()->GetPrefs()); | 292 page->profile()->GetPrefs()); |
| 274 } | 293 } |
| 275 page->ask_to_save_form_autofill_.SetValue(enabled); | 294 page->ask_to_save_form_autofill_.SetValue(enabled); |
| 276 } | 295 } |
| OLD | NEW |