Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1059)

Side by Side Diff: chrome/browser/chromeos/login/wizard_accessibility_helper.h

Issue 6312160: Map Views to Profiles directly from their window, eliminating the need... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map>
10 #include <vector>
11
12 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
13 #include "base/singleton.h" 10 #include "base/singleton.h"
14 #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h" 11 #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h"
15 #include "chrome/browser/ui/views/accessible_view_helper.h"
16 #include "chrome/common/notification_registrar.h" 12 #include "chrome/common/notification_registrar.h"
17 #include "ui/base/keycodes/keyboard_codes.h" 13 #include "ui/base/keycodes/keyboard_codes.h"
18 14
19 class Profile; 15 class Profile;
20 namespace views { 16 namespace views {
21 class Accelerator; 17 class Accelerator;
22 class View; 18 class View;
23 } 19 }
24 20
25 namespace chromeos { 21 namespace chromeos {
26 22
27 // Class that provides convenience methods to enable accessibility for a 23 // Class that provides convenience methods to enable accessibility for a
28 // specified View. 24 // specified View.
29 class WizardAccessibilityHelper { 25 class WizardAccessibilityHelper {
30 public: 26 public:
31 // Get Singleton instance of WizardAccessibilityHelper. 27 // Get Singleton instance of WizardAccessibilityHelper.
32 static WizardAccessibilityHelper* GetInstance(); 28 static WizardAccessibilityHelper* GetInstance();
33 29
34 // Get accelerator for enabling accessibility. 30 // Get accelerator for enabling accessibility.
35 static views::Accelerator GetAccelerator(); 31 static views::Accelerator GetAccelerator();
36 32
37 // Enables Accessibility by setting the accessibility pref and registers
38 // all views in the view buffer to raise accessibility notifications,
39 // including the specified |view_tree|.
40 void EnableAccessibilityForView(views::View* view_tree);
41
42 // Enables accessibility for the specified |view_tree| if the
43 // accessibility pref is already set. Otherwise the |view_tree| is
44 // added to a view buffer so that accessibility can be enabled for it
45 // later when requested.
46 void MaybeEnableAccessibility(views::View* view_tree);
47
48 // Speak the given text if the accessibility pref is already set. |queue| 33 // Speak the given text if the accessibility pref is already set. |queue|
49 // specifies whether this utterance will be queued or spoken immediately. 34 // specifies whether this utterance will be queued or spoken immediately.
50 // |interruptible| specified whether this utterance can be flushed by a 35 // |interruptible| specified whether this utterance can be flushed by a
51 // subsequent utterance. 36 // subsequent utterance.
52 // TODO (chaitanyag): Change API to use string16 instead of char*. 37 // TODO (chaitanyag): Change API to use string16 instead of char*.
53 void MaybeSpeak(const char* str, bool queue, bool interruptible); 38 void MaybeSpeak(const char* str, bool queue, bool interruptible);
54 39
55 // Unregisters all accessibility notifications 40 // Unregisters all accessibility notifications
56 void UnregisterNotifications(); 41 void UnregisterNotifications();
57 42
58 // Toggles accessibility support. If |view_tree| is null, only the 43 // Toggles accessibility support.
59 // access preference setting is toggled. |view_tree| has no effect while 44 void ToggleAccessibility();
60 // disabling accessibility.
61 void ToggleAccessibility(views::View* view_tree);
62 45
63 private: 46 private:
64 friend struct DefaultSingletonTraits<WizardAccessibilityHelper>; 47 friend struct DefaultSingletonTraits<WizardAccessibilityHelper>;
65 48
66 WizardAccessibilityHelper(); 49 WizardAccessibilityHelper();
67 50
68 virtual ~WizardAccessibilityHelper() {} 51 virtual ~WizardAccessibilityHelper() {}
69 52
70 void RegisterNotifications(); 53 void RegisterNotifications();
71 54
72 bool IsAccessibilityEnabled(); 55 bool IsAccessibilityEnabled();
73 56
74 void SetAccessibilityEnabled(bool); 57 void SetAccessibilityEnabled(bool);
75 58
76 static scoped_ptr<views::Accelerator> accelerator_; 59 static scoped_ptr<views::Accelerator> accelerator_;
77 60
78 void AddViewToBuffer(views::View* view_tree);
79
80 std::map<views::View*, bool> views_buffer_;
81
82 std::vector<AccessibleViewHelper*> accessible_view_helpers_;
83
84 scoped_ptr<WizardAccessibilityHandler> accessibility_handler_; 61 scoped_ptr<WizardAccessibilityHandler> accessibility_handler_;
85 62
86 Profile* profile_; 63 Profile* profile_;
87 64
88 // Used for tracking registrations to accessibility notifications. 65 // Used for tracking registrations to accessibility notifications.
89 NotificationRegistrar registrar_; 66 NotificationRegistrar registrar_;
90 67
91 bool registered_notifications_; 68 bool registered_notifications_;
92 69
93 DISALLOW_COPY_AND_ASSIGN(WizardAccessibilityHelper); 70 DISALLOW_COPY_AND_ASSIGN(WizardAccessibilityHelper);
94 }; 71 };
95 72
96 } // namespace chromeos 73 } // namespace chromeos
97 74
98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_ 75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image_view.cc ('k') | chrome/browser/chromeos/login/wizard_accessibility_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698