1 // Copyright 2014 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.
5 #include "base/logging.h"
6 #include "content/browser/accessibility/accessibility_mode_helper.h"
12 AccessibilityMode
CastToAccessibilityMode(unsigned int int_mode
) {
13 AccessibilityMode mode
= static_cast<AccessibilityMode
>(int_mode
);
15 case AccessibilityModeOff
:
16 case AccessibilityModeComplete
:
17 case AccessibilityModeTreeOnly
:
20 DCHECK(false) << "Could not convert to AccessibilityMode: " << int_mode
;
21 return AccessibilityModeOff
;
26 AccessibilityMode
GetBaseAccessibilityMode() {
27 AccessibilityMode accessibility_mode
= AccessibilityModeOff
;
28 return accessibility_mode
;
31 AccessibilityMode
AddAccessibilityModeTo(AccessibilityMode to
,
32 AccessibilityMode mode_to_add
) {
33 return CastToAccessibilityMode(to
| mode_to_add
);
36 AccessibilityMode
RemoveAccessibilityModeFrom(
37 AccessibilityMode from
,
38 AccessibilityMode mode_to_remove
) {
39 unsigned int new_mode
= from
^ (mode_to_remove
& from
);
40 return CastToAccessibilityMode(new_mode
);
43 } // namespace content