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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_
6#define CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_
7#pragma once
8
9#include "base/basictypes.h"
10
11template <typename T> struct DefaultSingletonTraits;
12
13// The BrowserAccessibilityState class is used to determine if Chrome should be
14// customized for users with assistive technology, such as screen readers. We
15// modify the behavior of certain user interfaces to provide a better experience
16// for screen reader users. The way we detect a screen reader program is
17// different for each platform.
18//
19// Screen Reader Detection
20// (1) On windows many screen reader detection mechinisms will give false
21// positives like relying on the SPI_GETSCREENREADER system parameter. In Chrome
22// we attempt to dynamically detect a MSAA client screen reader by calling
23// NotifiyWinEvent in WidgetWin with a custom ID and wait to see if the ID
24// is requested by a subsequent call to WM_GETOBJECT.
25// (2) On mac we detect if VoiceOver is running. This is stored in a preference
26// file for Universal Access with the key "voiceOverOnOffKey".
27class BrowserAccessibilityState {
28 public:
29  // Returns the singleton instance.
30  static BrowserAccessibilityState* GetInstance();
31
32  ~BrowserAccessibilityState();
33
34  // Called when screen reader client is detected.
35  void OnScreenReaderDetected();
36
37  // Returns true if the Chrome browser should be customized for accessibility.
38  bool IsAccessibleBrowser();
39
40 private:
41  BrowserAccessibilityState();
42  friend struct DefaultSingletonTraits<BrowserAccessibilityState>;
43
44  // Set to true when a screen reader client is detected.
45  bool screen_reader_active_;
46
47  DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityState);
48};
49
50#endif  // CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_H_
51