Chromium Code Reviews| Index: content/browser/accessibility/accessibility_mode_helper.cc |
| diff --git a/content/browser/accessibility/accessibility_mode_helper.cc b/content/browser/accessibility/accessibility_mode_helper.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0341b830a3fa7f679fe1d190dfea6936ada02900 |
| --- /dev/null |
| +++ b/content/browser/accessibility/accessibility_mode_helper.cc |
| @@ -0,0 +1,36 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/command_line.h" |
| +#include "content/browser/accessibility/accessibility_mode_helper.h" |
|
David Tseng
2014/02/06 19:13:44
I think this goes above all other includes.
aboxhall
2014/02/06 21:04:12
Oops, done.
|
| +#include "content/public/common/content_switches.h" |
| + |
| +namespace content { |
| + |
| +unsigned int AddAccessibilityModeTo(unsigned int to, |
| + AccessibilityMode mode_to_add) { |
| + return to | mode_to_add; |
| +} |
| + |
| +unsigned int RemoveAccessibilityModeFrom(unsigned int from, |
| + AccessibilityMode mode_to_remove) { |
| + int new_mode = from ^ (mode_to_remove & from); |
| +#if defined(OS_WIN) |
| + // On Windows 8, always enable accessibility for editable text controls |
| + // so we can show the virtual keyboard when one is enabled. |
| + if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
| + !CommandLine::ForCurrentProcess()->HasSwitch( |
|
David Tseng
2014/02/06 19:13:44
Seems unexpected to have the addition of this flag
aboxhall
2014/02/06 21:04:12
Done, although note that this code is functionally
|
| + switches::kDisableRendererAccessibility)) { |
| + AddAccessibilityModeTo(new_mode, AccessibilityModeEditableTextOnly); |
| + } |
| +#endif // defined(OS_WIN) |
| + |
| + if (CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kForceRendererAccessibility)) { |
| + AddAccessibilityModeTo(new_mode, AccessibilityModeComplete); |
|
David Tseng
2014/02/06 19:13:44
Also, seems odd to have this as a side effect of r
aboxhall
2014/02/06 21:04:12
Ok, removed.
|
| + } |
| + return new_mode; |
| +} |
| + |
| +} // namespace content |