• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_
7 #pragma once
8 
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/singleton.h"
11 #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h"
12 #include "content/common/notification_registrar.h"
13 #include "ui/base/keycodes/keyboard_codes.h"
14 
15 class Profile;
16 namespace views {
17 class Accelerator;
18 class View;
19 }
20 
21 namespace chromeos {
22 
23 // Class that provides convenience methods to enable accessibility for a
24 // specified View.
25 class WizardAccessibilityHelper {
26  public:
27   // Get Singleton instance of WizardAccessibilityHelper.
28   static WizardAccessibilityHelper* GetInstance();
29 
30   // Get accelerator for enabling accessibility.
31   static views::Accelerator GetAccelerator();
32 
33   // Speak the given text if the accessibility pref is already set. |queue|
34   // specifies whether this utterance will be queued or spoken immediately.
35   // |interruptible| specified whether this utterance can be flushed by a
36   // subsequent utterance.
37   // TODO (chaitanyag): Change API to use string16 instead of char*.
38   void MaybeSpeak(const char* str, bool queue, bool interruptible);
39 
40   // Unregisters all accessibility notifications
41   void UnregisterNotifications();
42 
43   // Toggles accessibility support.
44   void ToggleAccessibility();
45 
46   // Initialize accessibility
47   void Init();
48 
49  private:
50   friend struct DefaultSingletonTraits<WizardAccessibilityHelper>;
51 
52   WizardAccessibilityHelper();
53 
54   virtual ~WizardAccessibilityHelper() {}
55 
56   void RegisterNotifications();
57 
58   bool IsAccessibilityEnabled();
59 
60   void SetAccessibilityEnabled(bool);
61 
62   static scoped_ptr<views::Accelerator> accelerator_;
63 
64   scoped_ptr<WizardAccessibilityHandler> accessibility_handler_;
65 
66   Profile* profile_;
67 
68   // Used for tracking registrations to accessibility notifications.
69   NotificationRegistrar registrar_;
70 
71   bool registered_notifications_;
72 
73   DISALLOW_COPY_AND_ASSIGN(WizardAccessibilityHelper);
74 };
75 
76 }  // namespace chromeos
77 
78 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_ACCESSIBILITY_HELPER_H_
79