summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/options
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 22:41:03 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 22:41:03 +0000
commit922982c6528a80ee4079a6c221f513bc8a5ddbb9 (patch)
treebd6299d14a4291ec52c4e1a1c59f57d4c7bcc418 /chrome/browser/gtk/options
parent2de9333c9d608fcdfd0694d95652576718d4a4d0 (diff)
downloadchromium_src-922982c6528a80ee4079a6c221f513bc8a5ddbb9.zip
chromium_src-922982c6528a80ee4079a6c221f513bc8a5ddbb9.tar.gz
chromium_src-922982c6528a80ee4079a6c221f513bc8a5ddbb9.tar.bz2
Add an accessibility API for events raised outside of the web content.
BUG=none TEST=none patch by Dominic Mazzoni <dmazzoni [at] google> review url: http://codereview.chromium.org/402099/show Review URL: http://codereview.chromium.org/549182 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/options')
-rw-r--r--chrome/browser/gtk/options/advanced_contents_gtk.cc49
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.h2
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.cc4
-rw-r--r--chrome/browser/gtk/options/options_window_gtk.cc30
4 files changed, 81 insertions, 4 deletions
diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc
index d493a39..2ceb997 100644
--- a/chrome/browser/gtk/options/advanced_contents_gtk.cc
+++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/fonts_languages_window.h"
+#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/gtk/options/cookies_view.h"
#include "chrome/browser/gtk/options/options_layout_gtk.h"
@@ -82,6 +83,7 @@ GtkWidget* AddCheckButtonWithWrappedLabel(int string_id,
GtkWidget* checkbox = CreateCheckButtonWithWrappedLabel(string_id);
gtk_box_pack_start(GTK_BOX(container), checkbox, FALSE, FALSE, 0);
g_signal_connect(checkbox, "toggled", handler, data);
+
return checkbox;
}
@@ -167,13 +169,19 @@ class DownloadSection : public OptionsPageBase {
// then turning around and saving them again.
bool pref_changing_;
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadSection);
};
DownloadSection::DownloadSection(Profile* profile)
- : OptionsPageBase(profile), pref_changing_(true) {
+ : OptionsPageBase(profile),
+ pref_changing_(true) {
page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
+ accessible_widget_helper_.reset(new AccessibleWidgetHelper(
+ page_, profile));
+
// Download location options.
download_location_button_ = gtk_file_chooser_button_new(
l10n_util::GetStringUTF8(
@@ -212,6 +220,9 @@ DownloadSection::DownloadSection(Profile* profile)
FALSE, FALSE, 0);
g_signal_connect(download_ask_for_save_location_checkbox_, "clicked",
G_CALLBACK(OnDownloadAskForSaveLocationChanged), this);
+ accessible_widget_helper_->SetWidgetName(
+ download_ask_for_save_location_checkbox_,
+ IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION);
// Option for resetting file handlers.
reset_file_handlers_label_ = CreateWrappedLabel(
@@ -359,6 +370,7 @@ NetworkSection::NetworkSection(Profile* profile)
IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON).c_str());
g_signal_connect(change_proxies_button, "clicked",
G_CALLBACK(OnChangeProxiesButtonClicked), this);
+
// Stick it in an hbox so it doesn't expand to the whole width.
GtkWidget* button_hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(button_hbox),
@@ -526,6 +538,8 @@ class PrivacySection : public OptionsPageBase {
// then turning around and saving them again.
bool pref_changing_;
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
DISALLOW_COPY_AND_ASSIGN(PrivacySection);
};
@@ -534,6 +548,9 @@ PrivacySection::PrivacySection(Profile* profile)
pref_changing_(true) {
page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
+ accessible_widget_helper_.reset(new AccessibleWidgetHelper(
+ page_, profile));
+
GtkWidget* section_description_label = CreateWrappedLabel(
IDS_OPTIONS_DISABLE_SERVICES);
gtk_misc_set_alignment(GTK_MISC(section_description_label), 0, 0);
@@ -557,6 +574,8 @@ PrivacySection::PrivacySection(Profile* profile)
FALSE, FALSE, 0);
g_signal_connect(enable_link_doctor_checkbox_, "clicked",
G_CALLBACK(OnEnableLinkDoctorChange), this);
+ accessible_widget_helper_->SetWidgetName(
+ enable_link_doctor_checkbox_, IDS_OPTIONS_LINKDOCTOR_PREF);
enable_suggest_checkbox_ = CreateCheckButtonWithWrappedLabel(
IDS_OPTIONS_SUGGEST_PREF);
@@ -564,6 +583,8 @@ PrivacySection::PrivacySection(Profile* profile)
FALSE, FALSE, 0);
g_signal_connect(enable_suggest_checkbox_, "clicked",
G_CALLBACK(OnEnableSuggestChange), this);
+ accessible_widget_helper_->SetWidgetName(
+ enable_suggest_checkbox_, IDS_OPTIONS_SUGGEST_PREF);
enable_dns_prefetching_checkbox_ = CreateCheckButtonWithWrappedLabel(
IDS_NETWORK_DNS_PREFETCH_ENABLED_DESCRIPTION);
@@ -571,6 +592,9 @@ PrivacySection::PrivacySection(Profile* profile)
FALSE, FALSE, 0);
g_signal_connect(enable_dns_prefetching_checkbox_, "clicked",
G_CALLBACK(OnDNSPrefetchingChange), this);
+ accessible_widget_helper_->SetWidgetName(
+ enable_dns_prefetching_checkbox_,
+ IDS_NETWORK_DNS_PREFETCH_ENABLED_DESCRIPTION);
enable_safe_browsing_checkbox_ = CreateCheckButtonWithWrappedLabel(
IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION);
@@ -578,6 +602,9 @@ PrivacySection::PrivacySection(Profile* profile)
FALSE, FALSE, 0);
g_signal_connect(enable_safe_browsing_checkbox_, "clicked",
G_CALLBACK(OnSafeBrowsingChange), this);
+ accessible_widget_helper_->SetWidgetName(
+ enable_safe_browsing_checkbox_,
+ IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION);
#if defined(GOOGLE_CHROME_BUILD)
reporting_enabled_checkbox_ = CreateCheckButtonWithWrappedLabel(
@@ -586,6 +613,8 @@ PrivacySection::PrivacySection(Profile* profile)
FALSE, FALSE, 0);
g_signal_connect(reporting_enabled_checkbox_, "clicked",
G_CALLBACK(OnLoggingChange), this);
+ accessible_widget_helper_->SetWidgetName(
+ reporting_enabled_checkbox_, IDS_OPTIONS_ENABLE_LOGGING);
#endif
GtkWidget* cookie_description_label = gtk_label_new(
@@ -620,6 +649,7 @@ PrivacySection::PrivacySection(Profile* profile)
IDS_OPTIONS_COOKIES_SHOWCOOKIES_WEBSITE_PERMISSIONS).c_str());
g_signal_connect(show_cookies_button, "clicked",
G_CALLBACK(OnShowCookiesButtonClicked), this);
+
// Stick it in an hbox so it doesn't expand to the whole width.
GtkWidget* button_hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(button_hbox), show_cookies_button,
@@ -876,13 +906,19 @@ class SecuritySection : public OptionsPageBase {
// then turning around and saving them again.
bool pref_changing_;
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
DISALLOW_COPY_AND_ASSIGN(SecuritySection);
};
SecuritySection::SecuritySection(Profile* profile)
- : OptionsPageBase(profile), pref_changing_(true) {
+ : OptionsPageBase(profile),
+ pref_changing_(true) {
page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
+ accessible_widget_helper_.reset(new AccessibleWidgetHelper(
+ page_, profile));
+
GtkWidget* manage_certificates_label = CreateWrappedLabel(
IDS_OPTIONS_CERTIFICATES_LABEL);
gtk_misc_set_alignment(GTK_MISC(manage_certificates_label), 0, 0);
@@ -909,13 +945,20 @@ SecuritySection::SecuritySection(Profile* profile)
rev_checking_enabled_checkbox_ = AddCheckButtonWithWrappedLabel(
IDS_OPTIONS_SSL_CHECKREVOCATION, page_,
G_CALLBACK(OnRevCheckingEnabledToggled), this);
+ accessible_widget_helper_->SetWidgetName(
+ rev_checking_enabled_checkbox_, IDS_OPTIONS_SSL_CHECKREVOCATION);
ssl2_enabled_checkbox_ = AddCheckButtonWithWrappedLabel(
IDS_OPTIONS_SSL_USESSL2, page_, G_CALLBACK(OnSSL2EnabledToggled), this);
+ accessible_widget_helper_->SetWidgetName(
+ ssl2_enabled_checkbox_, IDS_OPTIONS_SSL_USESSL2);
ssl3_enabled_checkbox_ = AddCheckButtonWithWrappedLabel(
IDS_OPTIONS_SSL_USESSL3, page_, G_CALLBACK(OnSSL3EnabledToggled), this);
+ accessible_widget_helper_->SetWidgetName(
+ ssl3_enabled_checkbox_, IDS_OPTIONS_SSL_USESSL3);
tls1_enabled_checkbox_ = AddCheckButtonWithWrappedLabel(
IDS_OPTIONS_SSL_USETLS1, page_, G_CALLBACK(OnTLS1EnabledToggled), this);
-
+ accessible_widget_helper_->SetWidgetName(
+ tls1_enabled_checkbox_, IDS_OPTIONS_SSL_USETLS1);
rev_checking_enabled_.Init(prefs::kCertRevocationCheckingEnabled,
profile->GetPrefs(), this);
diff --git a/chrome/browser/gtk/options/content_page_gtk.h b/chrome/browser/gtk/options/content_page_gtk.h
index ba70861..b5ed627a 100644
--- a/chrome/browser/gtk/options/content_page_gtk.h
+++ b/chrome/browser/gtk/options/content_page_gtk.h
@@ -7,9 +7,9 @@
#include <gtk/gtk.h>
-#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/options_page_base.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/common/pref_member.h"
class ContentPageGtk : public OptionsPageBase,
diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc
index b491c629..d9ae203 100644
--- a/chrome/browser/gtk/options/general_page_gtk.cc
+++ b/chrome/browser/gtk/options/general_page_gtk.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/session_startup_pref.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/gtk_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
@@ -293,6 +294,7 @@ GtkWidget* GeneralPageGtk::InitHomepageGroup() {
G_CALLBACK(OnNewTabIsHomePageToggled), this);
gtk_box_pack_start(GTK_BOX(homepage_hbox), homepage_use_url_radio_,
FALSE, FALSE, 0);
+
homepage_use_url_entry_ = gtk_entry_new();
g_signal_connect(G_OBJECT(homepage_use_url_entry_), "changed",
G_CALLBACK(OnHomepageUseUrlEntryChanged), this);
@@ -361,6 +363,7 @@ GtkWidget* GeneralPageGtk::InitDefaultBrowserGroup() {
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str());
g_signal_connect(G_OBJECT(default_browser_use_as_default_button_), "clicked",
G_CALLBACK(OnBrowserUseAsDefaultClicked), this);
+
gtk_box_pack_start(GTK_BOX(vbox), default_browser_use_as_default_button_,
FALSE, FALSE, 0);
@@ -377,6 +380,7 @@ void GeneralPageGtk::OnStartupRadioToggled(GtkToggleButton* toggle_button,
GeneralPageGtk* general_page) {
if (general_page->initializing_)
return;
+
if (!gtk_toggle_button_get_active(toggle_button)) {
// When selecting a radio button, we get two signals (one for the old radio
// being toggled off, one for the new one being toggled on.) Ignore the
diff --git a/chrome/browser/gtk/options/options_window_gtk.cc b/chrome/browser/gtk/options/options_window_gtk.cc
index 2a12e12..709ee45 100644
--- a/chrome/browser/gtk/options/options_window_gtk.cc
+++ b/chrome/browser/gtk/options/options_window_gtk.cc
@@ -8,15 +8,19 @@
#include "app/l10n_util.h"
#include "base/message_loop.h"
+#include "base/scoped_ptr.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
#include "chrome/browser/gtk/options/advanced_page_gtk.h"
#include "chrome/browser/gtk/options/content_page_gtk.h"
#include "chrome/browser/gtk/options/general_page_gtk.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/window_sizer.h"
+#include "chrome/common/accessibility_events.h"
#include "chrome/common/gtk_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -68,6 +72,8 @@ class OptionsWindowGtk {
// The last page the user was on when they opened the Options window.
IntegerPrefMember last_selected_page_;
+ scoped_ptr<AccessibleWidgetHelper> accessibility_widget_helper_;
+
DISALLOW_COPY_AND_ASSIGN(OptionsWindowGtk);
};
@@ -85,6 +91,7 @@ OptionsWindowGtk::OptionsWindowGtk(Profile* profile)
general_page_(profile_),
content_page_(profile_),
advanced_page_(profile_) {
+
// We don't need to observe changes in this value.
last_selected_page_.Init(prefs::kOptionsWindowLastTabIndex,
g_browser_process->local_state(), NULL);
@@ -105,6 +112,9 @@ OptionsWindowGtk::OptionsWindowGtk(Profile* profile)
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
gtk_util::kContentAreaSpacing);
+ accessibility_widget_helper_.reset(new AccessibleWidgetHelper(
+ dialog_, profile));
+
notebook_ = gtk_notebook_new();
#if defined(OS_CHROMEOS)
@@ -248,10 +258,30 @@ void ShowOptionsWindow(OptionsPage page,
OptionsGroup highlight_group,
Profile* profile) {
DCHECK(profile);
+
// If there's already an existing options window, activate it and switch to
// the specified page.
if (!options_window) {
+ // Creating and initializing a bunch of controls generates a bunch of
+ // spurious events as control values change. Temporarily suppress
+ // accessibility events until the window is created.
+ profile->PauseAccessibilityEvents();
+
+ // Create the options window.
options_window = new OptionsWindowGtk(profile);
+
+ // Resume accessibility events.
+ profile->ResumeAccessibilityEvents();
}
options_window->ShowOptionsPage(page, highlight_group);
+
+ std::string name = l10n_util::GetStringFUTF8(
+ IDS_OPTIONS_DIALOG_TITLE,
+ WideToUTF16(l10n_util::GetString(IDS_PRODUCT_NAME)));
+ AccessibilityWindowInfo info(profile, name);
+
+ NotificationService::current()->Notify(
+ NotificationType::ACCESSIBILITY_WINDOW_OPENED,
+ Source<Profile>(profile),
+ Details<AccessibilityWindowInfo>(&info));
}