| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void DisableAccessibility() override; | 44 void DisableAccessibility() override; |
| 45 void ResetAccessibilityMode() override; | 45 void ResetAccessibilityMode() override; |
| 46 void OnScreenReaderDetected() override; | 46 void OnScreenReaderDetected() override; |
| 47 bool IsAccessibleBrowser() override; | 47 bool IsAccessibleBrowser() override; |
| 48 void AddHistogramCallback(base::Closure callback) override; | 48 void AddHistogramCallback(base::Closure callback) override; |
| 49 | 49 |
| 50 void UpdateHistogramsForTesting() override; | 50 void UpdateHistogramsForTesting() override; |
| 51 | 51 |
| 52 AccessibilityMode accessibility_mode() const { return accessibility_mode_; }; | 52 AccessibilityMode accessibility_mode() const { return accessibility_mode_; }; |
| 53 | 53 |
| 54 // Adds the given accessibility mode to the current accessibility mode bitmap. | 54 // Adds the given accessibility mode flags to the current accessibility |
| 55 void AddAccessibilityMode(AccessibilityMode mode); | 55 // mode bitmap. |
| 56 void AddAccessibilityModeFlags(AccessibilityMode mode); |
| 56 | 57 |
| 57 // Removes the given accessibility mode from the current accessibility mode | 58 // Remove the given accessibility mode flags from the current accessibility |
| 58 // bitmap, managing the bits that are shared with other modes such that a | 59 // mode bitmap. |
| 59 // bit will only be turned off when all modes that depend on it have been | 60 void RemoveAccessibilityModeFlags(AccessibilityMode mode); |
| 60 // removed. | |
| 61 void RemoveAccessibilityMode(AccessibilityMode mode); | |
| 62 | 61 |
| 63 // Accessibility objects can have the "hot tracked" state set when | 62 // Accessibility objects can have the "hot tracked" state set when |
| 64 // the mouse is hovering over them, but this makes tests flaky because | 63 // the mouse is hovering over them, but this makes tests flaky because |
| 65 // the test behaves differently when the mouse happens to be over an | 64 // the test behaves differently when the mouse happens to be over an |
| 66 // element. This is a global switch to not use the "hot tracked" state | 65 // element. This is a global switch to not use the "hot tracked" state |
| 67 // in a test. | 66 // in a test. |
| 68 void set_disable_hot_tracking_for_testing(bool disable_hot_tracking) { | 67 void set_disable_hot_tracking_for_testing(bool disable_hot_tracking) { |
| 69 disable_hot_tracking_ = disable_hot_tracking; | 68 disable_hot_tracking_ = disable_hot_tracking; |
| 70 } | 69 } |
| 71 bool disable_hot_tracking_for_testing() const { | 70 bool disable_hot_tracking_for_testing() const { |
| 72 return disable_hot_tracking_; | 71 return disable_hot_tracking_; |
| 73 } | 72 } |
| 74 | 73 |
| 75 private: | 74 private: |
| 76 friend class base::RefCountedThreadSafe<BrowserAccessibilityStateImpl>; | 75 friend class base::RefCountedThreadSafe<BrowserAccessibilityStateImpl>; |
| 77 friend struct base::DefaultSingletonTraits<BrowserAccessibilityStateImpl>; | 76 friend struct base::DefaultSingletonTraits<BrowserAccessibilityStateImpl>; |
| 78 | 77 |
| 79 // Resets accessibility_mode_ to the default value. | 78 // Resets accessibility_mode_ to the default value. |
| 80 void ResetAccessibilityModeValue(); | 79 void ResetAccessibilityModeValue(); |
| 81 | 80 |
| 82 // Called a short while after startup to allow time for the accessibility | 81 // Called a short while after startup to allow time for the accessibility |
| 83 // state to be determined. Updates histograms with the current state. | 82 // state to be determined. Updates histograms with the current state. |
| 84 void UpdateHistograms(); | 83 void UpdateHistograms(); |
| 85 | 84 |
| 86 // Leaky singleton, destructor generally won't be called. | 85 // Leaky singleton, destructor generally won't be called. |
| 87 ~BrowserAccessibilityStateImpl() override; | 86 ~BrowserAccessibilityStateImpl() override; |
| 88 | 87 |
| 89 void UpdatePlatformSpecificHistograms(); | 88 void UpdatePlatformSpecificHistograms(); |
| 90 | 89 |
| 91 // Updates the accessibility mode of all web contents, including swapped out | |
| 92 // ones. |add| specifies whether the mode should be added or removed. | |
| 93 void AddOrRemoveFromAllWebContents(AccessibilityMode mode, bool add); | |
| 94 | |
| 95 AccessibilityMode accessibility_mode_; | 90 AccessibilityMode accessibility_mode_; |
| 96 | 91 |
| 97 std::vector<base::Closure> histogram_callbacks_; | 92 std::vector<base::Closure> histogram_callbacks_; |
| 98 | 93 |
| 99 bool disable_hot_tracking_; | 94 bool disable_hot_tracking_; |
| 100 | 95 |
| 101 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityStateImpl); | 96 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityStateImpl); |
| 102 }; | 97 }; |
| 103 | 98 |
| 104 } // namespace content | 99 } // namespace content |
| 105 | 100 |
| 106 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_ | 101 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_STATE_IMPL_H_ |
| OLD | NEW |