diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-27 23:07:47 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-27 23:07:47 +0000 |
commit | e7cb7c391191e5b0973cdc6f533055aa227463d3 (patch) | |
tree | 42026d7e64be842f01fb58b92e2e375d9c58fed1 | |
parent | 23eda2f57f058bf1fb0633494c53d33c9f0f0182 (diff) | |
download | chromium_src-e7cb7c391191e5b0973cdc6f533055aa227463d3.zip chromium_src-e7cb7c391191e5b0973cdc6f533055aa227463d3.tar.gz chromium_src-e7cb7c391191e5b0973cdc6f533055aa227463d3.tar.bz2 |
revert 37335:
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37337 0039d316-1c4b-4281-b951-d872f2087c98
25 files changed, 12 insertions, 1533 deletions
diff --git a/chrome/browser/extensions/extension_accessibility_api.cc b/chrome/browser/extensions/extension_accessibility_api.cc deleted file mode 100644 index 24428af..0000000 --- a/chrome/browser/extensions/extension_accessibility_api.cc +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_tabs_module.h" - -#include "base/json/json_writer.h" -#include "base/string_util.h" -#include "base/values.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/browser_list.h" -#include "chrome/browser/browser_window.h" -#include "chrome/browser/extensions/extension_accessibility_api.h" -#include "chrome/browser/extensions/extension_accessibility_api_constants.h" -#include "chrome/browser/extensions/extension_function_dispatcher.h" -#include "chrome/browser/extensions/extension_message_service.h" -#include "chrome/browser/extensions/extensions_service.h" -#include "chrome/browser/profile.h" -#include "chrome/common/extensions/extension.h" - -namespace keys = extension_accessibility_api_constants; - -// Returns the AccessibilityControlInfo serialized into a JSON string, -// consisting of an array of a single object of type AccessibilityObject, -// as defined in the accessibility extension api's json schema. -std::string ControlInfoToJsonString(const AccessibilityControlInfo* info) { - ListValue args; - DictionaryValue* dict = new DictionaryValue(); - info->SerializeToDict(dict); - args.Append(dict); - std::string json_args; - base::JSONWriter::Write(&args, false, &json_args); - return json_args; -} - -ExtensionAccessibilityEventRouter* - ExtensionAccessibilityEventRouter::GetInstance() { - return Singleton<ExtensionAccessibilityEventRouter>::get(); -} - -void ExtensionAccessibilityEventRouter::ObserveProfile(Profile* profile) { - last_focused_control_dict_.Clear(); - - if (registrar_.IsEmpty()) { - registrar_.Add(this, - NotificationType::ACCESSIBILITY_WINDOW_OPENED, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::ACCESSIBILITY_WINDOW_CLOSED, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::ACCESSIBILITY_CONTROL_ACTION, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::ACCESSIBILITY_TEXT_CHANGED, - NotificationService::AllSources()); - } -} - -void ExtensionAccessibilityEventRouter::Observe( - NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - switch (type.value) { - case NotificationType::ACCESSIBILITY_WINDOW_OPENED: - OnWindowOpened(Details<const AccessibilityWindowInfo>(details).ptr()); - break; - case NotificationType::ACCESSIBILITY_WINDOW_CLOSED: - OnWindowClosed(Details<const AccessibilityWindowInfo>(details).ptr()); - break; - case NotificationType::ACCESSIBILITY_CONTROL_FOCUSED: - OnControlFocused(Details<const AccessibilityControlInfo>(details).ptr()); - break; - case NotificationType::ACCESSIBILITY_CONTROL_ACTION: - OnControlAction(Details<const AccessibilityControlInfo>(details).ptr()); - break; - case NotificationType::ACCESSIBILITY_TEXT_CHANGED: - OnTextChanged(Details<const AccessibilityControlInfo>(details).ptr()); - break; - default: - NOTREACHED(); - } -} - -void ExtensionAccessibilityEventRouter::SetAccessibilityEnabled(bool enabled) { - if (enabled_ != enabled) { - enabled_ = enabled; - if (enabled_) { - for (unsigned int i = 0; i < on_enabled_listeners_.size(); i++) { - on_enabled_listeners_[i]->Run(); - } - } else { - for (unsigned int i = 0; i < on_disabled_listeners_.size(); i++) { - on_disabled_listeners_[i]->Run(); - } - } - } -} - -bool ExtensionAccessibilityEventRouter::IsAccessibilityEnabled() const { - return enabled_; -} - -void ExtensionAccessibilityEventRouter::AddOnEnabledListener( - Callback* callback) { - on_enabled_listeners_.push_back(callback); -} - -void ExtensionAccessibilityEventRouter::AddOnDisabledListener( - Callback* callback) { - on_disabled_listeners_.push_back(callback); -} - -void ExtensionAccessibilityEventRouter::OnWindowOpened( - const AccessibilityWindowInfo* info) { - std::string json_args = ControlInfoToJsonString(info); - DispatchEvent(info->profile(), keys::kOnWindowOpened, json_args); -} - -void ExtensionAccessibilityEventRouter::OnWindowClosed( - const AccessibilityWindowInfo* info) { - std::string json_args = ControlInfoToJsonString(info); - DispatchEvent(info->profile(), keys::kOnWindowClosed, json_args); -} - -void ExtensionAccessibilityEventRouter::OnControlFocused( - const AccessibilityControlInfo* info) { - last_focused_control_dict_.Clear(); - info->SerializeToDict(&last_focused_control_dict_); - std::string json_args = ControlInfoToJsonString(info); - DispatchEvent(info->profile(), keys::kOnControlFocused, json_args); -} - -void ExtensionAccessibilityEventRouter::OnControlAction( - const AccessibilityControlInfo* info) { - std::string json_args = ControlInfoToJsonString(info); - DispatchEvent(info->profile(), keys::kOnControlAction, json_args); -} - -void ExtensionAccessibilityEventRouter::OnTextChanged( - const AccessibilityControlInfo* info) { - std::string json_args = ControlInfoToJsonString(info); - DispatchEvent(info->profile(), keys::kOnTextChanged, json_args); -} - -void ExtensionAccessibilityEventRouter::DispatchEvent( - Profile* profile, - const char* event_name, - const std::string& json_args) { - if (enabled_ && profile && profile->GetExtensionMessageService()) { - profile->GetExtensionMessageService()-> - DispatchEventToRenderers(event_name, json_args); - } -} - -bool SetAccessibilityEnabledFunction::RunImpl() { - bool enabled; - EXTENSION_FUNCTION_VALIDATE(args_->GetAsBoolean(&enabled)); - ExtensionAccessibilityEventRouter::GetInstance() - ->SetAccessibilityEnabled(enabled); - return true; -} - -bool GetFocusedControlFunction::RunImpl() { - // Get the serialized dict from the last focused control and return it. - // However, if the dict is empty, that means we haven't seen any focus - // events yet, so return null instead. - ExtensionAccessibilityEventRouter *accessibility_event_router = - ExtensionAccessibilityEventRouter::GetInstance(); - DictionaryValue *last_focused_control_dict = - accessibility_event_router->last_focused_control_dict(); - if (last_focused_control_dict->size()) { - result_.reset(last_focused_control_dict->DeepCopyWithoutEmptyChildren()); - } else { - result_.reset(Value::CreateNullValue()); - } - return true; -} diff --git a/chrome/browser/extensions/extension_accessibility_api.h b/chrome/browser/extensions/extension_accessibility_api.h deleted file mode 100644 index afae039..0000000 --- a/chrome/browser/extensions/extension_accessibility_api.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ - -#include <string> -#include <vector> - -#include "base/singleton.h" -#include "chrome/browser/extensions/extension_function.h" -#include "chrome/common/accessibility_events.h" -#include "chrome/common/notification_service.h" -#include "chrome/common/notification_registrar.h" - -// Observes the profile and routes accessibility notifications as events -// to the extension system. -class ExtensionAccessibilityEventRouter : public NotificationObserver { - public: - // Single instance of the event router. - static ExtensionAccessibilityEventRouter* GetInstance(); - - // Safe to call multiple times. - void ObserveProfile(Profile* profile); - - // Get the dict representing the last control that received an - // OnControlFocus event. - DictionaryValue* last_focused_control_dict() { - return &last_focused_control_dict_; - } - - // Accessibility support is disabled until an extension expicitly enables - // it, so that this extension api has no impact on Chrome's performance - // otherwise. These methods handle enabling, disabling, querying the - // status, and installing callbacks to execute when accessibility support - // is enabled or disabled. - void SetAccessibilityEnabled(bool enabled); - bool IsAccessibilityEnabled() const; - typedef Callback0::Type Callback; - void AddOnEnabledListener(Callback* callback); - void AddOnDisabledListener(Callback* callback); - - private: - friend struct DefaultSingletonTraits<ExtensionAccessibilityEventRouter>; - - ExtensionAccessibilityEventRouter() - : enabled_(false) {} - virtual ~ExtensionAccessibilityEventRouter() {} - - // NotificationObserver::Observe. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - void OnWindowOpened(const AccessibilityWindowInfo* details); - void OnWindowClosed(const AccessibilityWindowInfo* details); - void OnControlFocused(const AccessibilityControlInfo* details); - void OnControlAction(const AccessibilityControlInfo* details); - void OnTextChanged(const AccessibilityControlInfo* details); - - void DispatchEvent(Profile* profile, - const char* event_name, - const std::string& json_args); - - // Used for tracking registrations to history service notifications. - NotificationRegistrar registrar_; - - DictionaryValue last_focused_control_dict_; - - bool enabled_; - std::vector<Callback*> on_enabled_listeners_; - std::vector<Callback*> on_disabled_listeners_; - - DISALLOW_COPY_AND_ASSIGN(ExtensionAccessibilityEventRouter); -}; - -// API function that enables or disables accessibility support. Event -// listeners are only installed when accessibility support is enabled, to -// minimize the impact. -class SetAccessibilityEnabledFunction : public SyncExtensionFunction { - virtual ~SetAccessibilityEnabledFunction() {} - virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME( - "experimental.accessibility.setAccessibilityEnabled") -}; - -// API function that returns the most recent focused control. -class GetFocusedControlFunction : public SyncExtensionFunction { - virtual ~GetFocusedControlFunction() {} - virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME( - "experimental.accessibility.getFocusedControl") -}; - -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ diff --git a/chrome/browser/extensions/extension_accessibility_api_constants.cc b/chrome/browser/extensions/extension_accessibility_api_constants.cc deleted file mode 100644 index 72d6138..0000000 --- a/chrome/browser/extensions/extension_accessibility_api_constants.cc +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_accessibility_api_constants.h" - -namespace extension_accessibility_api_constants { - -// String keys for AccessibilityObject properties. -const wchar_t kTypeKey[] = L"type"; -const wchar_t kNameKey[] = L"name"; -const wchar_t kDetailsKey[] = L"details"; -const wchar_t kValueKey[] = L"details.value"; -const wchar_t kPasswordKey[] = L"details.isPassword"; -const wchar_t kItemCountKey[] = L"details.itemCount"; -const wchar_t kItemIndexKey[] = L"details.itemIndex"; -const wchar_t kSelectionStartKey[] = L"details.selectionStart"; -const wchar_t kSelectionEndKey[] = L"details.selectionEnd"; -const wchar_t kCheckedKey[] = L"details.isChecked"; - -// Events. -const char kOnWindowOpened[] = "experimental.accessibility.onWindowOpened"; -const char kOnWindowClosed[] = "experimental.accessibility.onWindowClosed"; -const char kOnControlFocused[] = "experimental.accessibility.onControlFocused"; -const char kOnControlAction[] = "experimental.accessibility.onControlAction"; -const char kOnTextChanged[] = "experimental.accessibility.onTextChanged"; - -// Types of controls that can receive accessibility events. -extern const char kTypeButton[] = "button"; -extern const char kTypeCheckbox[] = "checkbox"; -extern const char kTypeComboBox[] = "combobox"; -extern const char kTypeLink[] = "link"; -extern const char kTypeRadioButton[] = "radiobutton"; -extern const char kTypeTab[] = "tab"; -extern const char kTypeTextBox[] = "textbox"; -extern const char kTypeWindow[] = "window"; - -} // namespace extension_accessibility_api_constants diff --git a/chrome/browser/extensions/extension_accessibility_api_constants.h b/chrome/browser/extensions/extension_accessibility_api_constants.h deleted file mode 100644 index 2020ec8..0000000 --- a/chrome/browser/extensions/extension_accessibility_api_constants.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Constants used to for the Accessibility API. - -#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_CONSTANTS_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_CONSTANTS_H_ - -namespace extension_accessibility_api_constants { - -// Keys. -extern const wchar_t kTypeKey[]; -extern const wchar_t kNameKey[]; -extern const wchar_t kDetailsKey[]; -extern const wchar_t kValueKey[]; -extern const wchar_t kPasswordKey[]; -extern const wchar_t kItemCountKey[]; -extern const wchar_t kItemIndexKey[]; -extern const wchar_t kSelectionStartKey[]; -extern const wchar_t kSelectionEndKey[]; -extern const wchar_t kCheckedKey[]; - -// Events. -extern const char kOnWindowOpened[]; -extern const char kOnWindowClosed[]; -extern const char kOnControlFocused[]; -extern const char kOnControlAction[]; -extern const char kOnTextChanged[]; - -// Types of controls that can receive accessibility events -extern const char kTypeButton[]; -extern const char kTypeCheckbox[]; -extern const char kTypeComboBox[]; -extern const char kTypeLink[]; -extern const char kTypeRadioButton[]; -extern const char kTypeTab[]; -extern const char kTypeTextBox[]; -extern const char kTypeWindow[]; - -}; // namespace extension_accessibility_api_constants - -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_CONSTANTS_H_ diff --git a/chrome/browser/extensions/extension_accessibility_apitest.cc b/chrome/browser/extensions/extension_accessibility_apitest.cc deleted file mode 100644 index 692dc9c..0000000 --- a/chrome/browser/extensions/extension_accessibility_apitest.cc +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_apitest.h" - -// This extension is currently only supported on Linux and Chrome OS. -#if defined(OS_LINUX) -#define MAYBE_Accessibility Accessibility -#else -#define MAYBE_Accessibility DISABLED_Accessibility -#endif - -IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Accessibility) { - StartHTTPServer(); - ASSERT_TRUE(RunExtensionTest("accessibility")) << message_; -} diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 64d2f18..ba3e80e 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -10,7 +10,6 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/extensions/execute_code_in_tab_function.h" -#include "chrome/browser/extensions/extension_accessibility_api.h" #include "chrome/browser/extensions/extension_bookmark_manager_api.h" #include "chrome/browser/extensions/extension_bookmarks_module.h" #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" @@ -162,10 +161,6 @@ void FactoryRegistry::ResetFunctions() { RegisterFunction<ExtensionTestFailFunction>(); RegisterFunction<ExtensionTestLogFunction>(); RegisterFunction<ExtensionTestQuotaResetFunction>(); - - // Accessibility. - RegisterFunction<GetFocusedControlFunction>(); - RegisterFunction<SetAccessibilityEnabledFunction>(); } void FactoryRegistry::GetAllNames(std::vector<std::string>* names) { diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index b79880c..de75aba 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -14,7 +14,6 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/extensions/crx_installer.h" -#include "chrome/browser/extensions/extension_accessibility_api.h" #include "chrome/browser/extensions/extension_bookmarks_module.h" #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extension_dom_ui.h" @@ -163,7 +162,6 @@ void ExtensionsService::Init() { // Start up the extension event routers. ExtensionHistoryEventRouter::GetInstance()->ObserveProfile(profile_); - ExtensionAccessibilityEventRouter::GetInstance()->ObserveProfile(profile_); LoadAllExtensions(); diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.cc b/chrome/browser/gtk/accessibility_event_router_gtk.cc deleted file mode 100644 index c020721..0000000 --- a/chrome/browser/gtk/accessibility_event_router_gtk.cc +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/gtk/accessibility_event_router_gtk.h" - -#include "base/basictypes.h" -#include "base/stl_util-inl.h" -#include "chrome/browser/extensions/extension_accessibility_api.h" -#include "chrome/browser/gtk/gtk_chrome_link_button.h" -#include "chrome/browser/profile.h" -#include "chrome/common/notification_type.h" - -namespace { - -// -// Callbacks triggered by signals on gtk widgets. -// - -gboolean OnWidgetFocused(GSignalInvocationHint *ihint, - guint n_param_values, - const GValue* param_values, - gpointer user_data) { - GtkWidget* widget = GTK_WIDGET(g_value_get_object(param_values)); - reinterpret_cast<AccessibilityEventRouter *>(user_data) - ->DispatchAccessibilityNotification( - widget, NotificationType::ACCESSIBILITY_CONTROL_FOCUSED); - return true; -} - -gboolean OnButtonClicked(GSignalInvocationHint *ihint, - guint n_param_values, - const GValue* param_values, - gpointer user_data) { - GtkWidget* widget = GTK_WIDGET(g_value_get_object(param_values)); - // Skip toggle buttons because we're also listening on "toggle" events. - if (GTK_IS_TOGGLE_BUTTON(widget)) - return true; - reinterpret_cast<AccessibilityEventRouter *>(user_data) - ->DispatchAccessibilityNotification( - widget, NotificationType::ACCESSIBILITY_CONTROL_ACTION); - return true; -} - -gboolean OnButtonToggled(GSignalInvocationHint *ihint, - guint n_param_values, - const GValue* param_values, - gpointer user_data) { - GtkWidget* widget = GTK_WIDGET(g_value_get_object(param_values)); - bool checked = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - // Skip propagating an "uncheck" event for a radio button because it's - // redundant; there will always be a corresponding "check" event for - // a different radio button the group. - if (GTK_IS_RADIO_BUTTON(widget) && !checked) - return true; - reinterpret_cast<AccessibilityEventRouter *>(user_data) - ->DispatchAccessibilityNotification( - widget, NotificationType::ACCESSIBILITY_CONTROL_ACTION); - return true; -} - -gboolean OnSwitchPage(GSignalInvocationHint *ihint, - guint n_param_values, - const GValue* param_values, - gpointer user_data) { - GtkWidget* widget = GTK_WIDGET(g_value_get_object(param_values)); - reinterpret_cast<AccessibilityEventRouter *>(user_data) - ->DispatchAccessibilityNotification( - widget, NotificationType::ACCESSIBILITY_CONTROL_ACTION); - return true; -} - -} // anonymous namespace - -AccessibilityEventRouter::AccessibilityEventRouter() { - // We don't want our event listeners to be installed if accessibility is - // disabled. Install listeners so we can install and uninstall them as - // needed, then install them now if it's currently enabled. - ExtensionAccessibilityEventRouter *accessibility_event_router = - ExtensionAccessibilityEventRouter::GetInstance(); - accessibility_event_router->AddOnEnabledListener( - NewCallback(this, - &AccessibilityEventRouter::InstallEventListeners)); - accessibility_event_router->AddOnDisabledListener( - NewCallback(this, - &AccessibilityEventRouter::RemoveEventListeners)); - if (accessibility_event_router->IsAccessibilityEnabled()) { - InstallEventListeners(); - } -} - -// static -AccessibilityEventRouter* AccessibilityEventRouter::GetInstance() { - return Singleton<AccessibilityEventRouter>::get(); -} - -void AccessibilityEventRouter::InstallEventListeners() { - // Create and destroy a GtkNotebook to ensure this module is loaded, - // otherwise we can't lookup its signals. All of the other modules we - // need will already be loaded by the time we get here. - g_object_unref(g_object_ref_sink(gtk_notebook_new())); - - // Add signal emission hooks for the events we're interested in. - focus_hook_ = g_signal_add_emission_hook( - g_signal_lookup("focus-in-event", GTK_TYPE_WIDGET), - 0, OnWidgetFocused, (gpointer)this, NULL); - click_hook_ = g_signal_add_emission_hook( - g_signal_lookup("clicked", GTK_TYPE_BUTTON), - 0, OnButtonClicked, (gpointer)this, NULL); - toggle_hook_ = g_signal_add_emission_hook( - g_signal_lookup("toggled", GTK_TYPE_TOGGLE_BUTTON), - 0, OnButtonToggled, (gpointer)this, NULL); - switch_page_hook_ = g_signal_add_emission_hook( - g_signal_lookup("switch-page", GTK_TYPE_NOTEBOOK), - 0, OnSwitchPage, (gpointer)this, NULL); -} - -void AccessibilityEventRouter::RemoveEventListeners() { - g_signal_remove_emission_hook( - g_signal_lookup("focus-in-event", GTK_TYPE_WIDGET), focus_hook_); - g_signal_remove_emission_hook( - g_signal_lookup("clicked", GTK_TYPE_BUTTON), click_hook_); - g_signal_remove_emission_hook( - g_signal_lookup("toggled", GTK_TYPE_TOGGLE_BUTTON), toggle_hook_); - g_signal_remove_emission_hook( - g_signal_lookup("switch-page", GTK_TYPE_NOTEBOOK), switch_page_hook_); -} - -void AccessibilityEventRouter::AddRootWidget( - GtkWidget* root_widget, Profile* profile) { - root_widget_profile_map_[root_widget] = profile; -} - -void AccessibilityEventRouter::RemoveRootWidget(GtkWidget* root_widget) { - DCHECK(root_widget_profile_map_.find(root_widget) != - root_widget_profile_map_.end()); - root_widget_profile_map_.erase(root_widget); -} - -void AccessibilityEventRouter::IgnoreWidget(GtkWidget* widget) { - widget_info_map_[widget].ignore = true; -} - -void AccessibilityEventRouter::SetWidgetName( - GtkWidget* widget, std::string name) { - widget_info_map_[widget].name = name; -} - -void AccessibilityEventRouter::RemoveWidget(GtkWidget* widget) { - DCHECK(widget_info_map_.find(widget) != widget_info_map_.end()); - widget_info_map_.erase(widget); -} - -bool AccessibilityEventRouter::IsWidgetAccessible( - GtkWidget* widget, Profile** profile) { - // First see if it's a descendant of a root widget. - bool is_accessible = false; - for (base::hash_map<GtkWidget*, Profile*>::const_iterator iter = - root_widget_profile_map_.begin(); - iter != root_widget_profile_map_.end(); - ++iter) { - if (gtk_widget_is_ancestor(widget, iter->first)) { - is_accessible = true; - if (profile) - *profile = iter->second; - break; - } - } - if (!is_accessible) - return false; - - // Now make sure it's not marked as a widget to be ignored. - base::hash_map<GtkWidget*, WidgetInfo>::const_iterator iter = - widget_info_map_.find(widget); - if (iter != widget_info_map_.end() && iter->second.ignore) { - is_accessible = false; - } - - return is_accessible; -} - -std::string AccessibilityEventRouter::GetWidgetName(GtkWidget* widget) { - base::hash_map<GtkWidget*, WidgetInfo>::const_iterator iter = - widget_info_map_.find(widget); - if (iter != widget_info_map_.end()) { - return iter->second.name; - } else { - return ""; - } -} - -void AccessibilityEventRouter::DispatchAccessibilityNotification( - GtkWidget* widget, NotificationType type) { - Profile *profile; - if (!IsWidgetAccessible(widget, &profile)) - return; - - // The order of these checks matters, because, for example, a radio button - // is a subclass of button. We need to catch the most specific type that - // we can handle for each object. - if (GTK_IS_RADIO_BUTTON(widget)) { - SendRadioButtonNotification(widget, type, profile); - } else if (GTK_IS_TOGGLE_BUTTON(widget)) { - SendCheckboxNotification(widget, type, profile); - } else if (GTK_IS_BUTTON(widget)) { - SendButtonNotification(widget, type, profile); - } else if (GTK_IS_ENTRY(widget)) { - SendTextBoxNotification(widget, type, profile); - } else if (GTK_IS_NOTEBOOK(widget)) { - SendTabNotification(widget, type, profile); - } -} - -void AccessibilityEventRouter::SendRadioButtonNotification( - GtkWidget* widget, NotificationType type, Profile* profile) { - // Get the radio button name - std::string button_name = GetWidgetName(widget); - if (button_name.empty() && gtk_button_get_label(GTK_BUTTON(widget))) - button_name = gtk_button_get_label(GTK_BUTTON(widget)); - - // Get its state - bool checked = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - - // Get the index of this radio button and the total number of - // radio buttons in the group. - int item_count = 0; - int item_index = -1; - for (GSList* group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(widget)); - group; - group = group->next) { - if (group->data == widget) { - item_index = item_count; - } - item_count++; - } - item_index = item_count - 1 - item_index; - - AccessibilityRadioButtonInfo info( - profile, button_name, checked, item_index, item_count); - SendAccessibilityNotification(type, &info); -} - -void AccessibilityEventRouter::SendCheckboxNotification( - GtkWidget* widget, NotificationType type, Profile* profile) { - std::string button_name = GetWidgetName(widget); - if (button_name.empty() && gtk_button_get_label(GTK_BUTTON(widget))) - button_name = gtk_button_get_label(GTK_BUTTON(widget)); - bool checked = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - AccessibilityCheckboxInfo info(profile, button_name, checked); - SendAccessibilityNotification(type, &info); -} - -void AccessibilityEventRouter::SendButtonNotification( - GtkWidget* widget, NotificationType type, Profile* profile) { - std::string button_name = GetWidgetName(widget); - if (button_name.empty() && gtk_button_get_label(GTK_BUTTON(widget))) - button_name = gtk_button_get_label(GTK_BUTTON(widget)); - AccessibilityButtonInfo info(profile, button_name); - SendAccessibilityNotification(type, &info); -} - -void AccessibilityEventRouter::SendTextBoxNotification( - GtkWidget* widget, NotificationType type, Profile* profile) { - std::string name = GetWidgetName(widget); - std::string value = gtk_entry_get_text(GTK_ENTRY(widget)); - gint start_pos; - gint end_pos; - gtk_editable_get_selection_bounds(GTK_EDITABLE(widget), &start_pos, &end_pos); - AccessibilityTextBoxInfo info(profile, name, false); - info.SetValue(value, start_pos, end_pos); - SendAccessibilityNotification(type, &info); -} - -void AccessibilityEventRouter::SendTabNotification( - GtkWidget* widget, NotificationType type, Profile* profile) { - int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(widget)); - int page_count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(widget)); - GtkWidget* page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(widget), index); - GtkWidget* label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(widget), page); - std::string name = GetWidgetName(widget); - if (name.empty() && gtk_label_get_text(GTK_LABEL(label))) { - name = gtk_label_get_text(GTK_LABEL(label)); - } - AccessibilityTabInfo info(profile, name, index, page_count); - SendAccessibilityNotification(type, &info); -} diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.h b/chrome/browser/gtk/accessibility_event_router_gtk.h deleted file mode 100644 index d0fd99d..0000000 --- a/chrome/browser/gtk/accessibility_event_router_gtk.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_ -#define CHROME_BROWSER_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_ - -#include <gtk/gtk.h> - -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "base/hash_tables.h" -#include "base/singleton.h" -#include "chrome/common/accessibility_events.h" - -class Profile; - -// Allows us to use (GtkWidget*) in a hash_map with gcc. -namespace __gnu_cxx { -template<> -struct hash<GtkWidget*> { - size_t operator()(GtkWidget* widget) const { - return reinterpret_cast<size_t>(widget); - } -}; -} // namespace __gnu_cxx - -// Singleton class that adds a signal emission hook to many gtk events, and -// then sends an accessibility notification whenever a relevant event is -// sent to an accessible control. -// -// Gtk widgets are not accessible by default. When you register a root widget, -// that widget and all of its descendants will start sending accessibility -// event notifications. You can then override the default behavior for -// specific descendants using other methods. -// -// You can use Profile::PauseAccessibilityEvents to prevent a flurry -// of accessibility events when a window is being created or initialized. -class AccessibilityEventRouter { - public: - // Internal information about a particular widget to override the - // information we get directly from gtk. - struct WidgetInfo { - // If nonempty, will use this name instead of the widget's label. - std::string name; - - // If true, will ignore this widget and not send accessibility events. - bool ignore; - }; - - // Get the single instance of this class. - static AccessibilityEventRouter* GetInstance(); - - // Start sending accessibility events for this widget and all of its - // descendants. Notifications will go to the specified profile. - void AddRootWidget(GtkWidget* root_widget, Profile* profile); - - // Stop sending accessibility events for this widget and all of its - // descendants. - void RemoveRootWidget(GtkWidget* root_widget); - - // Don't send any events for this widget. - void IgnoreWidget(GtkWidget* widget); - - // Use the following string as the name of this widget, instead of the - // gtk label associated with the widget. - void SetWidgetName(GtkWidget* widget, std::string name); - - // Forget all information about this widget. - void RemoveWidget(GtkWidget* widget); - - // - // The following methods are only for use by gtk signal handlers. - // - - // Returns true if this widget is a descendant of one of our registered - // root widgets and not in the set of ignored widgets. If |profile| is - // not null, return the profile where notifications associated with this - // widget should be sent. - bool IsWidgetAccessible(GtkWidget* widget, Profile** profile); - - // Return the name of a widget. - std::string GetWidgetName(GtkWidget* widget); - - // Called by the signal handler. Checks the type of the widget and - // calls one of the more specific Send*Notification methods, below. - void DispatchAccessibilityNotification( - GtkWidget* widget, NotificationType type); - - // Each of these methods constructs an AccessibilityControlInfo object - // and sends a notification of a specific accessibility event. - void SendRadioButtonNotification( - GtkWidget* widget, NotificationType type, Profile* profile); - void SendCheckboxNotification( - GtkWidget* widget, NotificationType type, Profile* profile); - void SendButtonNotification( - GtkWidget* widget, NotificationType type, Profile* profile); - void SendTextBoxNotification( - GtkWidget* widget, NotificationType type, Profile* profile); - void SendTabNotification( - GtkWidget* widget, NotificationType type, Profile* profile); - - void InstallEventListeners(); - void RemoveEventListeners(); - - private: - AccessibilityEventRouter(); - virtual ~AccessibilityEventRouter() {} - - friend struct DefaultSingletonTraits<AccessibilityEventRouter>; - - // The set of all root widgets; only descendants of these will generate - // accessibility notifications. - base::hash_map<GtkWidget*, Profile*> root_widget_profile_map_; - - // Extra information about specific widgets. - base::hash_map<GtkWidget*, WidgetInfo> widget_info_map_; - - // Installed event listener hook ids so we can remove them later. - gulong focus_hook_; - gulong click_hook_; - gulong toggle_hook_; - gulong switch_page_hook_; - - std::vector<gulong> event_listener_hook_ids_; -}; - -#endif // CHROME_BROWSER_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_ diff --git a/chrome/browser/gtk/accessible_widget_helper_gtk.cc b/chrome/browser/gtk/accessible_widget_helper_gtk.cc deleted file mode 100644 index 64710b1..0000000 --- a/chrome/browser/gtk/accessible_widget_helper_gtk.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/gtk/accessible_widget_helper_gtk.h" - -#include "app/l10n_util.h" -#include "chrome/browser/profile.h" - -AccessibleWidgetHelper::AccessibleWidgetHelper( - GtkWidget* root_widget, Profile* profile) - : accessibility_event_router_(AccessibilityEventRouter::GetInstance()), - root_widget_(root_widget) { - accessibility_event_router_->AddRootWidget(root_widget_, profile); -} - -AccessibleWidgetHelper::~AccessibleWidgetHelper() { - if (root_widget_) - accessibility_event_router_->RemoveRootWidget(root_widget_); - for (unsigned int i = 0; i < managed_widgets_.size(); i++) { - accessibility_event_router_->RemoveWidget(managed_widgets_[i]); - } -} - -void AccessibleWidgetHelper::IgnoreWidget(GtkWidget* widget) { - accessibility_event_router_->IgnoreWidget(widget); - managed_widgets_.push_back(widget); -} - -void AccessibleWidgetHelper::SetWidgetName( - GtkWidget* widget, std::string name) { - accessibility_event_router_->SetWidgetName(widget, name); - managed_widgets_.push_back(widget); -} - -void AccessibleWidgetHelper::SetWidgetName( - GtkWidget* widget, int string_id) { - std::string name = l10n_util::GetStringUTF8(string_id); - accessibility_event_router_->SetWidgetName(widget, name); - managed_widgets_.push_back(widget); -} diff --git a/chrome/browser/gtk/accessible_widget_helper_gtk.h b/chrome/browser/gtk/accessible_widget_helper_gtk.h deleted file mode 100644 index 775b92e..0000000 --- a/chrome/browser/gtk/accessible_widget_helper_gtk.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ -#define CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ - -#include <gtk/gtk.h> - -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "base/singleton.h" -#include "chrome/browser/gtk/accessibility_event_router_gtk.h" -#include "chrome/common/accessibility_events.h" - -class Profile; - -// Helper class that helps to manage the accessibility information for all -// of the widgets in a container. Create an instance of this class for -// each container GtkWidget (like a dialog) that should send accessibility -// events for all of its descendants. -// -// Most controls have default behavior for accessibility; when this needs -// to be augmented, call one of the methods below to ignore a particular -// widget or change its details. -// -// All of the information managed by this class is registered with the -// (global) AccessibilityEventRouter and unregistered when this object is -// destroyed. -class AccessibleWidgetHelper { - public: - // Contruct an AccessibleWidgetHelper that makes the given root widget - // accessible for the lifetime of this object, sending accessibility - // notifications to the given profile. - AccessibleWidgetHelper(GtkWidget* root_widget, Profile* profile); - - virtual ~AccessibleWidgetHelper(); - - // Do not send accessibility events for this widget - void IgnoreWidget(GtkWidget* widget); - - // Use the following string as the name of this widget, instead of the - // gtk label associated with the widget. - void SetWidgetName(GtkWidget* widget, std::string name); - - // Use the following string as the name of this widget, instead of the - // gtk label associated with the widget. - void SetWidgetName(GtkWidget* widget, int string_id); - - private: - AccessibilityEventRouter* accessibility_event_router_; - GtkWidget* root_widget_; - std::vector<GtkWidget*> managed_widgets_; -}; - -#endif // CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index a52105d..2842fcd 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -19,7 +19,6 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/command_updater.h" -#include "chrome/browser/extensions/extension_accessibility_api_constants.h" #include "chrome/browser/extensions/extension_action_context_menu_model.h" #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extension_tabs_module.h" @@ -33,7 +32,6 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/common/accessibility_events.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/gtk_util.h" @@ -451,14 +449,6 @@ void LocationBarViewGtk::OnKillFocus() { } void LocationBarViewGtk::OnSetFocus() { - AccessibilityTextBoxInfo info( - profile_, - l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION).c_str(), - false); - NotificationService::current()->Notify( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, - Source<Profile>(profile_), - Details<AccessibilityTextBoxInfo>(&info)); } SkBitmap LocationBarViewGtk::GetFavIcon() const { diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc index 2ceb997..d493a39 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.cc +++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc @@ -18,7 +18,6 @@ #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" @@ -83,7 +82,6 @@ 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; } @@ -169,19 +167,13 @@ 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( @@ -220,9 +212,6 @@ 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( @@ -370,7 +359,6 @@ 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), @@ -538,8 +526,6 @@ 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); }; @@ -548,9 +534,6 @@ 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); @@ -574,8 +557,6 @@ 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); @@ -583,8 +564,6 @@ 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); @@ -592,9 +571,6 @@ 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); @@ -602,9 +578,6 @@ 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( @@ -613,8 +586,6 @@ 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( @@ -649,7 +620,6 @@ 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, @@ -906,19 +876,13 @@ 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); @@ -945,20 +909,13 @@ 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 b5ed627a..ba70861 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 d9ae203..b491c629 100644 --- a/chrome/browser/gtk/options/general_page_gtk.cc +++ b/chrome/browser/gtk/options/general_page_gtk.cc @@ -17,7 +17,6 @@ #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" @@ -294,7 +293,6 @@ 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); @@ -363,7 +361,6 @@ 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); @@ -380,7 +377,6 @@ 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 709ee45..2a12e12 100644 --- a/chrome/browser/gtk/options/options_window_gtk.cc +++ b/chrome/browser/gtk/options/options_window_gtk.cc @@ -8,19 +8,15 @@ #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" @@ -72,8 +68,6 @@ 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); }; @@ -91,7 +85,6 @@ 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); @@ -112,9 +105,6 @@ 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) @@ -258,30 +248,10 @@ 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)); } diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index 39b1c3d..0cc0e16 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -102,7 +102,7 @@ class Profile { // Value that represents no profile Id. static const ProfileId InvalidProfileId; - Profile() : restored_last_session_(false), accessibility_pause_level_(0) {} + Profile() : restored_last_session_(false) {} virtual ~Profile() {} // Profile prefs are registered as soon as the prefs are loaded for the first @@ -381,33 +381,11 @@ class Profile { return restored_last_session_; } - // Stop sending accessibility events until ResumeAccessibilityEvents(). - // Calls to Pause nest; no events will be sent until the number of - // Resume calls matches the number of Pause calls received. - void PauseAccessibilityEvents() { - accessibility_pause_level_++; - } - - void ResumeAccessibilityEvents() { - DCHECK(accessibility_pause_level_ > 0); - accessibility_pause_level_--; - } - - bool ShouldSendAccessibilityEvents() { - return 0 == accessibility_pause_level_; - } - protected: static URLRequestContextGetter* default_request_context_; private: bool restored_last_session_; - - // Accessibility events will only be propagated when the pause - // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents - // increment and decrement the level, respectively, rather than set it to - // true or false, so that calls can be nested. - int accessibility_pause_level_; }; class OffTheRecordProfileImpl; diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 2436a82..1bc51be 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -703,10 +703,6 @@ 'browser/extensions/crashed_extension_infobar.h', 'browser/extensions/crx_installer.cc', 'browser/extensions/crx_installer.h', - 'browser/extensions/extension_accessibility_api.cc', - 'browser/extensions/extension_accessibility_api.h', - 'browser/extensions/extension_accessibility_api_constants.cc', - 'browser/extensions/extension_accessibility_api_constants.h', 'browser/extensions/extension_action_context_menu_model.cc', 'browser/extensions/extension_action_context_menu_model.h', 'browser/extensions/extension_bookmarks_module.cc', @@ -849,10 +845,6 @@ 'browser/gtk/about_chrome_dialog.h', 'browser/gtk/accelerators_gtk.cc', 'browser/gtk/accelerators_gtk.h', - 'browser/gtk/accessibility_event_router_gtk.cc', - 'browser/gtk/accessibility_event_router_gtk.h', - 'browser/gtk/accessible_widget_helper_gtk.cc', - 'browser/gtk/accessible_widget_helper_gtk.h', 'browser/gtk/back_forward_button_gtk.cc', 'browser/gtk/back_forward_button_gtk.h', 'browser/gtk/blocked_popup_container_view_gtk.cc', @@ -2382,8 +2374,6 @@ ['exclude', '^browser/gtk'], ['include', '^browser/gtk/about_chrome_dialog.cc'], ['include', '^browser/gtk/about_chrome_dialog.h'], - ['include', '^browser/gtk/accessibility_events_gtk.cc'], - ['include', '^browser/gtk/accessibility_events_gtk.h'], ['include', '^browser/gtk/bookmark_context_menu_gtk.cc'], ['include', '^browser/gtk/bookmark_context_menu_gtk.h'], ['include', '^browser/gtk/bookmark_editor_gtk.cc'], diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index bf3bfb4..e2c7d87 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -34,8 +34,6 @@ # .cc, .h, and .mm files under chrome/common that are used on all # platforms, including both 32-bit and 64-bit Windows. # Test files are not included. - 'common/accessibility_events.h', - 'common/accessibility_events.cc', 'common/bindings_policy.h', 'common/child_process.cc', 'common/child_process.h', diff --git a/chrome/common/accessibility_events.cc b/chrome/common/accessibility_events.cc deleted file mode 100644 index 17dc491..0000000 --- a/chrome/common/accessibility_events.cc +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_accessibility_api_constants.h" -#include "chrome/browser/profile.h" -#include "chrome/common/accessibility_events.h" -#include "chrome/common/notification_service.h" -#include "chrome/common/notification_type.h" - -namespace keys = extension_accessibility_api_constants; - -void SendAccessibilityNotification( - NotificationType type, AccessibilityControlInfo* info) { - Profile *profile = info->profile(); - if (profile->ShouldSendAccessibilityEvents()) { - NotificationService::current()->Notify( - type, - Source<Profile>(profile), - Details<AccessibilityControlInfo>(info)); - } -} - -void AccessibilityControlInfo::SerializeToDict(DictionaryValue *dict) const { - dict->SetString(keys::kNameKey, name_); -} - -void AccessibilityWindowInfo::SerializeToDict(DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeWindow); -} - -void AccessibilityButtonInfo::SerializeToDict(DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeButton); -} - -void AccessibilityLinkInfo::SerializeToDict(DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeLink); -} - -void AccessibilityRadioButtonInfo::SerializeToDict( - DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeRadioButton); - dict->SetBoolean(keys::kCheckedKey, checked_); - dict->SetInteger(keys::kItemIndexKey, item_index_); - dict->SetInteger(keys::kItemCountKey, item_count_); -} - -void AccessibilityCheckboxInfo::SerializeToDict(DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeCheckbox); - dict->SetBoolean(keys::kCheckedKey, checked_); -} - -void AccessibilityTabInfo::SerializeToDict(DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeTab); - dict->SetInteger(keys::kItemIndexKey, tab_index_); - dict->SetInteger(keys::kItemCountKey, tab_count_); -} - -void AccessibilityComboBoxInfo::SerializeToDict(DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeComboBox); - dict->SetString(keys::kValueKey, value_); - dict->SetInteger(keys::kItemIndexKey, item_index_); - dict->SetInteger(keys::kItemCountKey, item_count_); -} - -void AccessibilityTextBoxInfo::SerializeToDict(DictionaryValue *dict) const { - AccessibilityControlInfo::SerializeToDict(dict); - dict->SetString(keys::kTypeKey, keys::kTypeTextBox); - dict->SetString(keys::kValueKey, value_); - dict->SetBoolean(keys::kPasswordKey, password_); - dict->SetInteger(keys::kSelectionStartKey, selection_start_); - dict->SetInteger(keys::kSelectionEndKey, selection_end_); -} diff --git a/chrome/common/accessibility_events.h b/chrome/common/accessibility_events.h deleted file mode 100644 index bfcf2ae..0000000 --- a/chrome/common/accessibility_events.h +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_ACCESSIBILITY_EVENTS_H_ -#define CHROME_COMMON_ACCESSIBILITY_EVENTS_H_ - -#include <string> - -#include "base/values.h" - -class AccessibilityControlInfo; -class NotificationType; -class Profile; - -// Use the NotificationService to post the given accessibility -// notification type with AccessibilityControlInfo details to any -// listeners. Will not send if the profile's pause level is nonzero -// (using profile->PauseAccessibilityEvents). -void SendAccessibilityNotification( - NotificationType type, AccessibilityControlInfo* info); - -// Abstract parent class for accessibility information about a control -// passed to event listeners. -class AccessibilityControlInfo { - public: - virtual ~AccessibilityControlInfo() { } - - // Serialize this class as a DictionaryValue that can be converted to - // a JavaScript object. - virtual void SerializeToDict(DictionaryValue *dict) const; - - Profile* profile() const { return profile_; } - - const std::string& name() const { return name_; } - - protected: - // The constructor can only be called by subclasses. - AccessibilityControlInfo(Profile* profile, std::string control_name) - : profile_(profile), name_(control_name) { } - - // The profile this control belongs to. - Profile* profile_; - - // The name of the control, like "OK" or "Password". - std::string name_; -}; - -// Accessibility information about a window passed to onWindowOpened -// and onWindowClosed event listeners. -class AccessibilityWindowInfo : public AccessibilityControlInfo { - public: - AccessibilityWindowInfo(Profile* profile, std::string window_name) - : AccessibilityControlInfo(profile, window_name) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; -}; - -// Accessibility information about a push button passed to onControlFocused -// and onControlAction event listeners. -class AccessibilityButtonInfo : public AccessibilityControlInfo { - public: - AccessibilityButtonInfo(Profile* profile, std::string button_name) - : AccessibilityControlInfo(profile, button_name) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; -}; - -// Accessibility information about a hyperlink passed to onControlFocused -// and onControlAction event listeners. -class AccessibilityLinkInfo : public AccessibilityControlInfo { - public: - AccessibilityLinkInfo(Profile* profile, std::string link_name) - : AccessibilityControlInfo(profile, link_name) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; -}; - -// Accessibility information about a radio button passed to onControlFocused -// and onControlAction event listeners. -class AccessibilityRadioButtonInfo : public AccessibilityControlInfo { - public: - AccessibilityRadioButtonInfo(Profile* profile, - std::string name, - bool checked, - int item_index, - int item_count) - : AccessibilityControlInfo(profile, name), - checked_(checked), - item_index_(item_index), - item_count_(item_count) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; - - void SetChecked(bool checked) { checked_ = checked; } - - private: - bool checked_; - // The 0-based index of this radio button and number of buttons in the group. - int item_index_; - int item_count_; -}; - -// Accessibility information about a checkbox passed to onControlFocused -// and onControlAction event listeners. -class AccessibilityCheckboxInfo : public AccessibilityControlInfo { - public: - AccessibilityCheckboxInfo(Profile* profile, - std::string name, - bool checked) - : AccessibilityControlInfo(profile, name), - checked_(checked) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; - - void SetChecked(bool checked) { checked_ = checked; } - - private: - bool checked_; -}; - -// Accessibility information about a tab passed to onControlFocused -// and onControlAction event listeners. -class AccessibilityTabInfo : public AccessibilityControlInfo { - public: - AccessibilityTabInfo(Profile* profile, - std::string tab_name, - int tab_index, - int tab_count) - : AccessibilityControlInfo(profile, tab_name), - tab_index_(tab_index), - tab_count_(tab_count) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; - - void SetTab(int tab_index, std::string tab_name) { - tab_index_ = tab_index; - name_ = tab_name; - } - - private: - // The 0-based index of this tab and number of tabs in the group. - int tab_index_; - int tab_count_; -}; - -// Accessibility information about a combo box passed to onControlFocused -// and onControlAction event listeners. -class AccessibilityComboBoxInfo : public AccessibilityControlInfo { - public: - AccessibilityComboBoxInfo(Profile* profile, - std::string name, - std::string value, - int item_index, - int item_count) - : AccessibilityControlInfo(profile, name), - value_(value), - item_index_(item_index), - item_count_(item_count) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; - - void SetValue(int item_index, std::string value) { - item_index_ = item_index; - value_ = value; - } - - private: - std::string value_; - // The 0-based index of the current item and the number of total items. - // If the value is not one of the drop-down options, item_index_ should - // be -1. - int item_index_; - int item_count_; -}; - -// Accessibility information about a text box, passed to onControlFocused, -// onControlAction, and onTextChanged event listeners. -class AccessibilityTextBoxInfo : public AccessibilityControlInfo { - public: - AccessibilityTextBoxInfo(Profile* profile, - std::string name, - bool password) - : AccessibilityControlInfo(profile, name), - value_(""), - password_(password), - selection_start_(0), - selection_end_(0) { } - - virtual void SerializeToDict(DictionaryValue *dict) const; - - void SetValue(std::string value, int selection_start, int selection_end) { - value_ = value; - selection_start_ = selection_start; - selection_end_ = selection_end; - } - - private: - std::string value_; - bool password_; - int selection_start_; - int selection_end_; -}; - -#endif // CHROME_COMMON_ACCESSIBILITY_EVENTS_H_ diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 5e3515c..5a3e6c5 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -203,183 +203,6 @@ ] }, { - "namespace": "experimental.accessibility", - "types": [ - { - "id": "AccessibilityObject", - "type": "object", - "description": "Parent class for accessibility information about an object.", - "properties": { - "type": { - "type": "string", - "description": "The type of this object, which determines the contents of 'details'.", - "enum": ["button", "checkbox", "combobox", "link", "radiobutton", "tab", "textbox", "window"] - }, - "name": { - "type": "string", - "description": "The localized name of the object, like OK or Password. Do not rely on an exact string match because the text will be in the user's language and may change in the future." - }, - "details": { - "description": "Other details like the state, depending on the type of object.", - "optional": true, - "choices": [ - { "$ref": "CheckboxDetails" }, - { "$ref": "ComboBoxDetails" }, - { "$ref": "RadioButtonDetails" }, - { "$ref": "TabDetails" }, - { "$ref": "TextBoxDetails" } - ] - } - } - }, - { - "id": "CheckboxDetails", - "type": "object", - "description": "Information about the state of a checkbox.", - "properties": { - "isChecked": {"type": "boolean", "description": "True if this checkbox is checked."} - } - }, - { - "id": "ComboBoxDetails", - "type": "object", - "description": "Information about the state of a combo box.", - "properties": { - "value": {"type": "string", "description": "The value of the combo box."}, - "itemCount": {"type": "integer", "description": "The number of items in the combo box's list."}, - "itemIndex": {"type": "integer", "description": "The 0-based index of the current value, or -1 if the user entered a value not from the list."} - } - }, - { - "id": "RadioButtonDetails", - "type": "object", - "description": "Information about the state of a radio button.", - "properties": { - "isChecked": {"type": "boolean", "description": "True if this radio button is checked."}, - "itemCount": {"type": "integer", "description": "The number of radio buttons in this group."}, - "itemIndex": {"type": "integer", "description": "The 0-based index of this radio button in this group."} - } - }, - { - "id": "TabDetails", - "type": "object", - "description": "Additional accessibility information about a tab.", - "properties": { - "itemCount": {"type": "integer", "description": "The number of tabs in this group."}, - "itemIndex": {"type": "integer", "description": "The 0-based index of this tab in this group."} - } - }, - { - "id": "TextBoxDetails", - "type": "object", - "description": "Information about the state of a text box.", - "properties": { - "value": {"type": "string", "description": "The value of the text box - the entered text."}, - "isPassword": {"type": "boolean", "description": "True if this control contains password text whose contents should be obscured."}, - "selectionStart": {"type": "integer", "description": "The index of the character where the selection starts, if this control contains editable text."}, - "selectionEnd": {"type": "integer", "description": "The index of the character where the selection ends, if this control contains editable text."} - } - } - ], - "functions": [ - { - "name": "setAccessibilityEnabled", - "type": "function", - "description": "Enable or disable the accessibility extension api. This must be set to true before event listeners or getFocusedControl will work.", - "parameters": [ - { - "type": "boolean", - "name": "enabled", - "description": "True if accessibility support should be enabled." - } - ] - }, - { - "name": "getFocusedControl", - "type": "function", - "description": "Get information about the currently focused control.", - "parameters": [ - { - "type": "function", - "name": "callback", - "parameters": [ - { - "name": "control", - "description": "Details of the currently focused control, or null if nothing is focused.", - "choices": [ - { "$ref": "AccessibilityObject" }, - { "type": "null" } - ] - } - ] - } - ] - } - ], - "events": [ - { - "name": "onWindowOpened", - "type": "function", - "description": "Fired when a window is opened.", - "parameters": [ - { - "$ref": "AccessibilityObject", - "name": "window", - "description": "Information about the window that was opened." - } - ] - }, - { - "name": "onWindowClosed", - "type": "function", - "description": "Fired when a window is closed.", - "parameters": [ - { - "$ref": "AccessibilityObject", - "name": "window", - "description": "Information about the window that was closed." - } - ] - }, - { - "name": "onControlFocused", - "type": "function", - "description": "Fired when a control is focused.", - "parameters": [ - { - "$ref": "AccessibilityObject", - "name": "control", - "description": "Details of the control that was focused." - } - ] - }, - { - "name": "onControlAction", - "type": "function", - "description": "Fired when a control's action is taken, like pressing a button or toggling a checkbox.", - "parameters": [ - { - "$ref": "AccessibilityObject", - "name": "control", - "description": "Details of the control whose action was taken." - } - ] - }, - { - "name": "onTextChanged", - "type": "function", - "description": "Fired when text changes in an editable text control.", - "parameters": [ - { - "$ref": "AccessibilityObject", - "name": "control", - "description": "Details of the control where the text changed." - } - ] - } - ] - }, - { "namespace": "experimental.extension", "nodoc": true, "types": [], diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index af2a382..2d8f839 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -798,30 +798,6 @@ class NotificationType { // memory in use, no source or details are passed. See memory_purger.h .cc. PURGE_MEMORY, - // Accessibility Notifications --------------------------------------------- - - // Notification that a window in the browser UI (not the web content) - // was opened, for propagating to an accessibility extension. - // Details will be an AccessibilityWindowInfo. - ACCESSIBILITY_WINDOW_OPENED, - - // Notification that a window in the browser UI was closed. - // Details will be an AccessibilityWindowInfo. - ACCESSIBILITY_WINDOW_CLOSED, - - // Notification that a control in the browser UI was focused. - // Details will be an AccessibilityControlInfo. - ACCESSIBILITY_CONTROL_FOCUSED, - - // Notification that a control in the browser UI had its action taken, - // like pressing a button or toggling a checkbox. - // Details will be an AccessibilityControlInfo. - ACCESSIBILITY_CONTROL_ACTION, - - // Notification that text box in the browser UI had text change. - // Details will be an AccessibilityControlInfo. - ACCESSIBILITY_TEXT_CHANGED, - // Count (must be last) ---------------------------------------------------- // Used to determine the number of notification types. Not valid as // a type parameter when registering for or posting notifications. diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index 0412a58..9d207f1 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -551,9 +551,6 @@ var chrome = chrome || {}; if (!chrome.experimental) chrome.experimental = {}; - if (!chrome.experimental.accessibility) - chrome.experimental.accessibility = {}; - if (!chrome.experimental.history) chrome.experimental.history = {}; diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js index 3f54143..870d43e 100644 --- a/chrome/renderer/resources/renderer_extension_bindings.js +++ b/chrome/renderer/resources/renderer_extension_bindings.js @@ -241,28 +241,14 @@ var chrome = chrome || {}; // that should prevent it from getting stale). var privileged = [ // Entire namespaces. - "bookmarks", - "browserAction", - "devtools", - "experimental.accessibility", - "experimental.bookmarkManager", - "experimental.extension", - "experimental.history", - "experimental.popup", - "pageAction", - "pageActions", - "tabs", - "test", - "toolstrip", - "windows", + "bookmarks", "browserAction", "devtools", "experimental.bookmarkManager", + "experimental.extension", "experimental.history", "experimental.popup", + "pageAction", "pageActions", "tabs", "test", "toolstrip", "windows", + // Functions/events/properties within the extension namespace. - "extension.getBackgroundPage", - "extension.getExtensionTabs", - "extension.getToolstrips", - "extension.getViews", - "extension.lastError", - "extension.onConnectExternal", - "extension.onRequestExternal", + "extension.getBackgroundPage", "extension.getExtensionTabs", + "extension.getToolstrips", "extension.getViews", "extension.lastError", + "extension.onConnectExternal", "extension.onRequestExternal", "i18n.getAcceptLanguages" ]; for (var i = 0; i < privileged.length; i++) { |