summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/accessibility_event_router_gtk.cc
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-01 12:19:54 +0000
committerIain Merrick <husky@google.com>2010-11-03 10:21:10 +0000
commit731df977c0511bca2206b5f333555b1205ff1f43 (patch)
tree0e750b949b3f00a1ac11fda25d3c2de512f2b465 /chrome/browser/gtk/accessibility_event_router_gtk.cc
parent5add15e10e7bb80512f2c597ca57221314abe577 (diff)
downloadexternal_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'chrome/browser/gtk/accessibility_event_router_gtk.cc')
-rw-r--r--chrome/browser/gtk/accessibility_event_router_gtk.cc47
1 files changed, 20 insertions, 27 deletions
diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.cc b/chrome/browser/gtk/accessibility_event_router_gtk.cc
index 6d04cbd..0de0f91 100644
--- a/chrome/browser/gtk/accessibility_event_router_gtk.cc
+++ b/chrome/browser/gtk/accessibility_event_router_gtk.cc
@@ -274,55 +274,48 @@ void AccessibilityEventRouterGtk::RemoveEventListeners() {
void AccessibilityEventRouterGtk::AddRootWidget(
GtkWidget* root_widget, Profile* profile) {
- root_widget_profile_map_[root_widget] = profile;
+ root_widget_info_map_[root_widget].refcount++;
+ root_widget_info_map_[root_widget].profile = profile;
}
void AccessibilityEventRouterGtk::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 AccessibilityEventRouterGtk::IgnoreWidget(GtkWidget* widget) {
- widget_info_map_[widget].ignore = true;
+ DCHECK(root_widget_info_map_.find(root_widget) !=
+ root_widget_info_map_.end());
+ root_widget_info_map_[root_widget].refcount--;
+ if (root_widget_info_map_[root_widget].refcount == 0) {
+ root_widget_info_map_.erase(root_widget);
+ }
}
-void AccessibilityEventRouterGtk::SetWidgetName(
+void AccessibilityEventRouterGtk::AddWidgetNameOverride(
GtkWidget* widget, std::string name) {
widget_info_map_[widget].name = name;
+ widget_info_map_[widget].refcount++;
}
-void AccessibilityEventRouterGtk::RemoveWidget(GtkWidget* widget) {
+void AccessibilityEventRouterGtk::RemoveWidgetNameOverride(GtkWidget* widget) {
DCHECK(widget_info_map_.find(widget) != widget_info_map_.end());
- widget_info_map_.erase(widget);
+ widget_info_map_[widget].refcount--;
+ if (widget_info_map_[widget].refcount == 0) {
+ widget_info_map_.erase(widget);
+ }
}
void AccessibilityEventRouterGtk::FindWidget(
GtkWidget* widget, Profile** profile, bool* is_accessible) {
*is_accessible = false;
- // First see if it's a descendant of a root widget.
- for (base::hash_map<GtkWidget*, Profile*>::const_iterator iter =
- root_widget_profile_map_.begin();
- iter != root_widget_profile_map_.end();
+ for (base::hash_map<GtkWidget*, RootWidgetInfo>::const_iterator iter =
+ root_widget_info_map_.begin();
+ iter != root_widget_info_map_.end();
++iter) {
- if (gtk_widget_is_ancestor(widget, iter->first)) {
+ if (widget == iter->first || gtk_widget_is_ancestor(widget, iter->first)) {
*is_accessible = true;
if (profile)
- *profile = iter->second;
+ *profile = iter->second.profile;
break;
}
}
- if (!*is_accessible)
- return;
-
- // 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;
- }
}
std::string AccessibilityEventRouterGtk::GetWidgetName(GtkWidget* widget) {