diff options
author | Iain Merrick <husky@google.com> | 2010-10-19 14:37:37 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-10-19 14:37:37 +0100 |
commit | 3345a6884c488ff3a535c2c9acdd33d74b37e311 (patch) | |
tree | 7784b988ef1698cb6967ea1bdf07616237716c6c /chrome/browser/gtk/accessibility_event_router_gtk.cc | |
parent | efc8475837ec58186051f23bb03542620424f6ce (diff) | |
download | external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.zip external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.gz external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.bz2 |
Merge Chromium at 7.0.540.0 : Initial merge by git
Not including third_party/icu as it contains huge data files that break Gerrit, and aren't actually used.
Change-Id: I428a386e70f3b58cacd28677b8cfda282e891e15
Diffstat (limited to 'chrome/browser/gtk/accessibility_event_router_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/accessibility_event_router_gtk.cc | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.cc b/chrome/browser/gtk/accessibility_event_router_gtk.cc index 606fd40..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 @@ -325,6 +345,12 @@ void AccessibilityEventRouterGtk::StopListening() { void AccessibilityEventRouterGtk::DispatchAccessibilityNotification( GtkWidget* widget, NotificationType type) { + // If there's no message loop, we must be about to shutdown or we're + // running inside a test; either way, there's no reason to do any + // further processing. + if (!MessageLoop::current()) + return; + if (!listening_) return; @@ -405,6 +431,9 @@ void AccessibilityEventRouterGtk::DispatchAccessibilityNotification( void AccessibilityEventRouterGtk::PostDispatchAccessibilityNotification( GtkWidget* widget, NotificationType type) { + if (!MessageLoop::current()) + return; + MessageLoop::current()->PostTask( FROM_HERE, method_factory_.NewRunnableMethod( &AccessibilityEventRouterGtk::DispatchAccessibilityNotification, @@ -467,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); } @@ -485,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); } |