1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_BROWSER_ACCESSIBILITY_STATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_ACCESSIBILITY_STATE_H_ 7 8 #include "base/callback_forward.h" 9 10 #include "content/common/content_export.h" 11 #include "ui/accessibility/ax_mode.h" 12 13 namespace content { 14 15 // The BrowserAccessibilityState class is used to determine if the browser 16 // should be customized for users with assistive technology, such as screen 17 // readers. 18 class CONTENT_EXPORT BrowserAccessibilityState { 19 public: ~BrowserAccessibilityState()20 virtual ~BrowserAccessibilityState() { } 21 22 // Returns the singleton instance. 23 static BrowserAccessibilityState* GetInstance(); 24 25 // Enables accessibility for all running tabs. 26 virtual void EnableAccessibility() = 0; 27 28 // Disables accessibility for all running tabs. (Only if accessibility is not 29 // required by a command line flag or by a platform requirement.) 30 virtual void DisableAccessibility() = 0; 31 32 virtual bool IsRendererAccessibilityEnabled() = 0; 33 34 virtual ui::AXMode GetAccessibilityMode() = 0; 35 36 // Adds the given accessibility mode flags to the current accessibility 37 // mode bitmap. 38 virtual void AddAccessibilityModeFlags(ui::AXMode mode) = 0; 39 40 // Remove the given accessibility mode flags from the current accessibility 41 // mode bitmap. 42 virtual void RemoveAccessibilityModeFlags(ui::AXMode mode) = 0; 43 44 // Resets accessibility to the platform default for all running tabs. 45 // This is probably off, but may be on, if --force_renderer_accessibility is 46 // passed, or EditableTextOnly if this is Win7. 47 virtual void ResetAccessibilityMode() = 0; 48 49 // Called when screen reader client is detected. 50 virtual void OnScreenReaderDetected() = 0; 51 52 // Returns true if the browser should be customized for accessibility. 53 virtual bool IsAccessibleBrowser() = 0; 54 55 // Add a callback method that will be called once, a small while after the 56 // browser starts up, when accessibility state histograms are updated. 57 // Use this to register a method to update additional accessibility 58 // histograms. 59 // 60 // Use this variant for a callback that must be run on the UI thread, 61 // for example something that needs to access prefs. 62 virtual void AddUIThreadHistogramCallback(base::OnceClosure callback) = 0; 63 64 // Use this variant for a callback that's better to run on another 65 // thread, for example something that may block or run slowly. 66 virtual void AddOtherThreadHistogramCallback(base::OnceClosure callback) = 0; 67 68 // Fire frequent metrics signals to ensure users keeping browser open multiple 69 // days are counted each day, not only at launch. This is necessary, because 70 // UMA only aggregates uniques on a daily basis, 71 virtual void UpdateUniqueUserHistograms() = 0; 72 73 virtual void UpdateHistogramsForTesting() = 0; 74 75 // Update BrowserAccessibilityState with the current status of caret browsing. 76 virtual void SetCaretBrowsingState(bool enabled) = 0; 77 }; 78 79 } // namespace content 80 81 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_ACCESSIBILITY_STATE_H_ 82