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