summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/accessibility_event_router_gtk.cc
diff options
context:
space:
mode:
authorchaitanyag@chromium.org <chaitanyag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 21:22:55 +0000
committerchaitanyag@chromium.org <chaitanyag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 21:22:55 +0000
commit83d1d571d3eca7d64a03365b803dabfb89407cf5 (patch)
tree0456abbd903fa45f7ff767d69f49d9f302019236 /chrome/browser/gtk/accessibility_event_router_gtk.cc
parent8c306d32c47d777be2fa19e292d6e9a774c2a248 (diff)
downloadchromium_src-83d1d571d3eca7d64a03365b803dabfb89407cf5.zip
chromium_src-83d1d571d3eca7d64a03365b803dabfb89407cf5.tar.gz
chromium_src-83d1d571d3eca7d64a03365b803dabfb89407cf5.tar.bz2
Fixing the problem where accessibility events for password fields did not set the password boolean field.
Review URL: http://codereview.chromium.org/3353005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/accessibility_event_router_gtk.cc')
-rw-r--r--chrome/browser/gtk/accessibility_event_router_gtk.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.cc b/chrome/browser/gtk/accessibility_event_router_gtk.cc
index 95e63d5..6d04cbd 100644
--- a/chrome/browser/gtk/accessibility_event_router_gtk.cc
+++ b/chrome/browser/gtk/accessibility_event_router_gtk.cc
@@ -12,6 +12,12 @@
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_type.h"
+#include "views/controls/textfield/native_textfield_gtk.h"
+
+#if defined(TOOLKIT_VIEWS)
+#include "views/controls/textfield/gtk_views_textview.h"
+#include "views/controls/textfield/gtk_views_entry.h"
+#endif
namespace {
@@ -210,6 +216,20 @@ void AccessibilityEventRouterGtk::InstallEventListener(
installed_hooks_.push_back(InstalledHook(signal_id, hook_id));
}
+bool AccessibilityEventRouterGtk::IsPassword(GtkWidget* widget) {
+ bool is_password = false;
+#if defined (TOOLKIT_VIEWS)
+ is_password = (GTK_IS_ENTRY(widget) &&
+ GTK_VIEWS_ENTRY(widget)->host != NULL &&
+ GTK_VIEWS_ENTRY(widget)->host->IsPassword()) ||
+ (GTK_IS_TEXT_VIEW(widget) &&
+ GTK_VIEWS_TEXTVIEW(widget)->host != NULL &&
+ GTK_VIEWS_TEXTVIEW(widget)->host->IsPassword());
+#endif
+ return is_password;
+}
+
+
void AccessibilityEventRouterGtk::InstallEventListeners() {
// Create and destroy each type of widget we need signals for,
// to ensure their modules are loaded, otherwise g_signal_lookup
@@ -476,7 +496,7 @@ void AccessibilityEventRouterGtk::SendEntryNotification(
gint start_pos;
gint end_pos;
gtk_editable_get_selection_bounds(GTK_EDITABLE(widget), &start_pos, &end_pos);
- AccessibilityTextBoxInfo info(profile, name, false);
+ AccessibilityTextBoxInfo info(profile, name, IsPassword(widget));
info.SetValue(value, start_pos, end_pos);
SendAccessibilityNotification(type, &info);
}
@@ -494,7 +514,7 @@ void AccessibilityEventRouterGtk::SendTextViewNotification(
gtk_text_buffer_get_selection_bounds(buffer, &sel_start, &sel_end);
int start_pos = gtk_text_iter_get_offset(&sel_start);
int end_pos = gtk_text_iter_get_offset(&sel_end);
- AccessibilityTextBoxInfo info(profile, name, false);
+ AccessibilityTextBoxInfo info(profile, name, IsPassword(widget));
info.SetValue(value, start_pos, end_pos);
SendAccessibilityNotification(type, &info);
}