| 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 #include "chrome/browser/chromeos/extensions/info_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/info_private_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 // Key which corresponds to the screen magnifier A11Y property in JS. | 75 // Key which corresponds to the screen magnifier A11Y property in JS. |
| 76 const char kPropertyScreenMagnifierEnabled[] = "a11yScreenMagnifierEnabled"; | 76 const char kPropertyScreenMagnifierEnabled[] = "a11yScreenMagnifierEnabled"; |
| 77 | 77 |
| 78 // Key which corresponds to the auto click A11Y property in JS. | 78 // Key which corresponds to the auto click A11Y property in JS. |
| 79 const char kPropertyAutoclickEnabled[] = "a11yAutoClickEnabled"; | 79 const char kPropertyAutoclickEnabled[] = "a11yAutoClickEnabled"; |
| 80 | 80 |
| 81 // Key which corresponds to the auto click A11Y property in JS. | 81 // Key which corresponds to the auto click A11Y property in JS. |
| 82 const char kPropertyVirtualKeyboardEnabled[] = "a11yVirtualKeyboardEnabled"; | 82 const char kPropertyVirtualKeyboardEnabled[] = "a11yVirtualKeyboardEnabled"; |
| 83 | 83 |
| 84 // Key which corresponds to the caret highlight A11Y property in JS. |
| 85 const char kPropertyCaretHighlightEnabled[] = "a11yCaretHighlightEnabled"; |
| 86 |
| 87 // Key which corresponds to the cursor highlight A11Y property in JS. |
| 88 const char kPropertyCursorHighlightEnabled[] = "a11yCursorHighlightEnabled"; |
| 89 |
| 90 // Key which corresponds to the focus highlight A11Y property in JS. |
| 91 const char kPropertyFocusHighlightEnabled[] = "a11yFocusHighlightEnabled"; |
| 92 |
| 93 // Key which corresponds to the select-to-speak A11Y property in JS. |
| 94 const char kPropertySelectToSpeakEnabled[] = "a11ySelectToSpeakEnabled"; |
| 95 |
| 96 // Key which corresponds to the switch access A11Y property in JS. |
| 97 const char kPropertySwitchAccessEnabled[] = "a11ySwitchAccessEnabled"; |
| 98 |
| 84 // Key which corresponds to the send-function-keys property in JS. | 99 // Key which corresponds to the send-function-keys property in JS. |
| 85 const char kPropertySendFunctionsKeys[] = "sendFunctionKeys"; | 100 const char kPropertySendFunctionsKeys[] = "sendFunctionKeys"; |
| 86 | 101 |
| 87 // Property not found error message. | 102 // Property not found error message. |
| 88 const char kPropertyNotFound[] = "Property '*' does not exist."; | 103 const char kPropertyNotFound[] = "Property '*' does not exist."; |
| 89 | 104 |
| 90 const struct { | 105 const struct { |
| 91 const char* api_name; | 106 const char* api_name; |
| 92 const char* preference_name; | 107 const char* preference_name; |
| 93 } kPreferencesMap[] = { | 108 } kPreferencesMap[] = { |
| 94 {kPropertyLargeCursorEnabled, prefs::kAccessibilityLargeCursorEnabled}, | 109 {kPropertyLargeCursorEnabled, prefs::kAccessibilityLargeCursorEnabled}, |
| 95 {kPropertyStickyKeysEnabled, prefs::kAccessibilityStickyKeysEnabled}, | 110 {kPropertyStickyKeysEnabled, prefs::kAccessibilityStickyKeysEnabled}, |
| 96 {kPropertySpokenFeedbackEnabled, | 111 {kPropertySpokenFeedbackEnabled, |
| 97 prefs::kAccessibilitySpokenFeedbackEnabled}, | 112 prefs::kAccessibilitySpokenFeedbackEnabled}, |
| 98 {kPropertyHighContrastEnabled, prefs::kAccessibilityHighContrastEnabled}, | 113 {kPropertyHighContrastEnabled, prefs::kAccessibilityHighContrastEnabled}, |
| 99 {kPropertyScreenMagnifierEnabled, | 114 {kPropertyScreenMagnifierEnabled, |
| 100 prefs::kAccessibilityScreenMagnifierEnabled}, | 115 prefs::kAccessibilityScreenMagnifierEnabled}, |
| 101 {kPropertyAutoclickEnabled, prefs::kAccessibilityAutoclickEnabled}, | 116 {kPropertyAutoclickEnabled, prefs::kAccessibilityAutoclickEnabled}, |
| 102 {kPropertyVirtualKeyboardEnabled, | 117 {kPropertyVirtualKeyboardEnabled, |
| 103 prefs::kAccessibilityVirtualKeyboardEnabled}, | 118 prefs::kAccessibilityVirtualKeyboardEnabled}, |
| 104 {kPropertySendFunctionsKeys, prefs::kLanguageSendFunctionKeys}}; | 119 {kPropertyCaretHighlightEnabled, |
| 120 prefs::kAccessibilityCaretHighlightEnabled}, |
| 121 {kPropertyCursorHighlightEnabled, |
| 122 prefs::kAccessibilityCursorHighlightEnabled}, |
| 123 {kPropertyFocusHighlightEnabled, |
| 124 prefs::kAccessibilityFocusHighlightEnabled}, |
| 125 {kPropertySelectToSpeakEnabled, prefs::kAccessibilitySelectToSpeakEnabled}, |
| 126 {kPropertySwitchAccessEnabled, prefs::kAccessibilitySwitchAccessEnabled}, |
| 127 {kPropertySendFunctionsKeys, prefs::kLanguageSendFunctionKeys}}; |
| 105 | 128 |
| 106 const char* GetBoolPrefNameForApiProperty(const char* api_name) { | 129 const char* GetBoolPrefNameForApiProperty(const char* api_name) { |
| 107 for (size_t i = 0; | 130 for (size_t i = 0; |
| 108 i < (sizeof(kPreferencesMap)/sizeof(*kPreferencesMap)); | 131 i < (sizeof(kPreferencesMap)/sizeof(*kPreferencesMap)); |
| 109 i++) { | 132 i++) { |
| 110 if (strcmp(kPreferencesMap[i].api_name, api_name) == 0) | 133 if (strcmp(kPreferencesMap[i].api_name, api_name) == 0) |
| 111 return kPreferencesMap[i].preference_name; | 134 return kPreferencesMap[i].preference_name; |
| 112 } | 135 } |
| 113 | 136 |
| 114 return NULL; | 137 return NULL; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } else { | 254 } else { |
| 232 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); | 255 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); |
| 233 return false; | 256 return false; |
| 234 } | 257 } |
| 235 } | 258 } |
| 236 | 259 |
| 237 return true; | 260 return true; |
| 238 } | 261 } |
| 239 | 262 |
| 240 } // namespace extensions | 263 } // namespace extensions |
| OLD | NEW |