summaryrefslogtreecommitdiffstats
path: root/content/browser/accessibility/browser_accessibility_state_impl.h
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 19:53:26 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 19:53:26 +0000
commitfa4f91688f50803b510b21d0040deac6cd4f73a1 (patch)
treeb3a8c5758993411b32b7470af7f384ace82ff425 /content/browser/accessibility/browser_accessibility_state_impl.h
parent0ccc3f7ce460094544cf8383f828a1811e1a58bf (diff)
downloadchromium_src-fa4f91688f50803b510b21d0040deac6cd4f73a1.zip
chromium_src-fa4f91688f50803b510b21d0040deac6cd4f73a1.tar.gz
chromium_src-fa4f91688f50803b510b21d0040deac6cd4f73a1.tar.bz2
Create content API for BrowserAccessibilityState
BUG=98716 TEST=none TBR=sky Review URL: http://codereview.chromium.org/9421030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/accessibility/browser_accessibility_state_impl.h')
-rw-r--r--content/browser/accessibility/browser_accessibility_state_impl.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/content/browser/accessibility/browser_accessibility_state_impl.h b/content/browser/accessibility/browser_accessibility_state_impl.h
new file mode 100644
index 0000000..413f639
--- /dev/null
+++ b/content/browser/accessibility/browser_accessibility_state_impl.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_
+#define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/timer.h"
+#include "content/public/browser/browser_accessibility_state.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+// The BrowserAccessibilityState class is used to determine if Chrome should be
+// customized for users with assistive technology, such as screen readers. We
+// modify the behavior of certain user interfaces to provide a better experience
+// for screen reader users. The way we detect a screen reader program is
+// different for each platform.
+//
+// Screen Reader Detection
+// (1) On windows many screen reader detection mechinisms will give false
+// positives like relying on the SPI_GETSCREENREADER system parameter. In Chrome
+// we attempt to dynamically detect a MSAA client screen reader by calling
+// NotifiyWinEvent in NativeWidgetWin with a custom ID and wait to see if the ID
+// is requested by a subsequent call to WM_GETOBJECT.
+// (2) On mac we detect dynamically if VoiceOver is running. We rely upon the
+// undocumented accessibility attribute @"AXEnhancedUserInterface" which is set
+// when VoiceOver is launched and unset when VoiceOver is closed. This is an
+// improvement over reading defaults preference values (which has no callback
+// mechanism).
+class CONTENT_EXPORT BrowserAccessibilityStateImpl
+ : public BrowserAccessibilityState {
+ public:
+ virtual ~BrowserAccessibilityStateImpl();
+
+ static BrowserAccessibilityStateImpl* GetInstance();
+
+ virtual void OnAccessibilityEnabledManually() OVERRIDE;
+ virtual void OnScreenReaderDetected() OVERRIDE;
+ virtual bool IsAccessibleBrowser() OVERRIDE;
+
+ // Called a short while after startup to allow time for the accessibility
+ // state to be determined. Updates a histogram with the current state.
+ void UpdateHistogram();
+
+ protected:
+ BrowserAccessibilityStateImpl();
+
+ friend struct DefaultSingletonTraits<BrowserAccessibilityStateImpl>;
+
+ // Set to true when full accessibility features should be enabled.
+ bool accessibility_enabled_;
+
+ // Timer to update the histogram a short while after startup.
+ base::OneShotTimer<BrowserAccessibilityStateImpl> update_histogram_timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityStateImpl);
+};
+
+#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_