| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ | 6 #define CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include "chrome/browser/ui/gtk/accessible_widget_helper_gtk.h" |
| 10 | 10 // TODO(msw): remove this file once all includes have been updated. |
| 11 #include <set> | |
| 12 #include <string> | |
| 13 | |
| 14 #include "base/basictypes.h" | |
| 15 #include "base/singleton.h" | |
| 16 #include "chrome/browser/accessibility_events.h" | |
| 17 #include "chrome/browser/gtk/accessibility_event_router_gtk.h" | |
| 18 | |
| 19 class Profile; | |
| 20 | |
| 21 // NOTE: This class is part of the Accessibility Extension API, which lets | |
| 22 // extensions receive accessibility events. It's distinct from code that | |
| 23 // implements platform accessibility APIs like MSAA or ATK. | |
| 24 // | |
| 25 // Helper class that helps to manage the accessibility information for all | |
| 26 // of the widgets in a container. Create an instance of this class for | |
| 27 // each container GtkWidget (like a dialog) that should send accessibility | |
| 28 // events for all of its descendants. | |
| 29 // | |
| 30 // Most controls have default behavior for accessibility; when this needs | |
| 31 // to be augmented, call one of the methods below to change its details. | |
| 32 // | |
| 33 // All of the information managed by this class is registered with the | |
| 34 // (global) AccessibilityEventRouterGtk and unregistered when this object is | |
| 35 // destroyed. | |
| 36 class AccessibleWidgetHelper { | |
| 37 public: | |
| 38 // Contruct an AccessibleWidgetHelper that makes the given root widget | |
| 39 // accessible for the lifetime of this object, sending accessibility | |
| 40 // notifications to the given profile. | |
| 41 AccessibleWidgetHelper(GtkWidget* root_widget, Profile* profile); | |
| 42 | |
| 43 virtual ~AccessibleWidgetHelper(); | |
| 44 | |
| 45 // Send a notification that a new window was opened now, and a | |
| 46 // corresponding close window notification when this object | |
| 47 // goes out of scope. | |
| 48 void SendOpenWindowNotification(const std::string& window_title); | |
| 49 | |
| 50 // Use the following string as the name of this widget, instead of the | |
| 51 // gtk label associated with the widget. | |
| 52 void SetWidgetName(GtkWidget* widget, std::string name); | |
| 53 | |
| 54 // Use the following string as the name of this widget, instead of the | |
| 55 // gtk label associated with the widget. | |
| 56 void SetWidgetName(GtkWidget* widget, int string_id); | |
| 57 | |
| 58 private: | |
| 59 AccessibilityEventRouterGtk* accessibility_event_router_; | |
| 60 Profile* profile_; | |
| 61 GtkWidget* root_widget_; | |
| 62 std::string window_title_; | |
| 63 std::set<GtkWidget*> managed_widgets_; | |
| 64 }; | |
| 65 | 11 |
| 66 #endif // CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ | 12 #endif // CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ |
| OLD | NEW |