[Storage] Blob Storage Refactoring pt 1:
[chromium-blink-merge.git] / content / browser / accessibility / accessibility_mode_helper.cc
blob9745e63e453333691e4281522ca7209f9fa43626
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"
8 namespace content {
10 namespace {
12 AccessibilityMode CastToAccessibilityMode(unsigned int int_mode) {
13 AccessibilityMode mode = static_cast<AccessibilityMode>(int_mode);
14 switch (mode) {
15 case AccessibilityModeOff:
16 case AccessibilityModeComplete:
17 case AccessibilityModeTreeOnly:
18 return mode;
20 DCHECK(false) << "Could not convert to AccessibilityMode: " << int_mode;
21 return AccessibilityModeOff;
24 } // namespace
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