Index: chrome/browser/gtk/options/options_window_gtk.cc |
=================================================================== |
--- chrome/browser/gtk/options/options_window_gtk.cc (revision 37511) |
+++ chrome/browser/gtk/options/options_window_gtk.cc (working copy) |
@@ -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 @@ |
// 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 @@ |
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 @@ |
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 @@ |
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)); |
} |