| 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 "content/browser/accessibility/browser_accessibility_state_impl.h" | 5 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "content/browser/accessibility/accessibility_mode_helper.h" | 10 #include "content/browser/accessibility/accessibility_mode_helper.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 void BrowserAccessibilityStateImpl::ResetAccessibilityModeValue() { | 76 void BrowserAccessibilityStateImpl::ResetAccessibilityModeValue() { |
| 77 accessibility_mode_ = AccessibilityModeOff; | 77 accessibility_mode_ = AccessibilityModeOff; |
| 78 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 78 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 79 switches::kForceRendererAccessibility)) { | 79 switches::kForceRendererAccessibility)) { |
| 80 accessibility_mode_ = AccessibilityModeComplete; | 80 accessibility_mode_ = AccessibilityModeComplete; |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 void BrowserAccessibilityStateImpl::EnableAutomation() { |
| 85 AddAccessibilityMode(AccessibilityModeTreeOnly); |
| 86 } |
| 87 |
| 88 void BrowserAccessibilityStateImpl::DisableAutomation() { |
| 89 RemoveAccessibilityMode(AccessibilityModeTreeOnly); |
| 90 } |
| 91 |
| 84 void BrowserAccessibilityStateImpl::ResetAccessibilityMode() { | 92 void BrowserAccessibilityStateImpl::ResetAccessibilityMode() { |
| 85 ResetAccessibilityModeValue(); | 93 ResetAccessibilityModeValue(); |
| 86 | 94 |
| 87 std::vector<WebContentsImpl*> web_contents_vector = | 95 std::vector<WebContentsImpl*> web_contents_vector = |
| 88 WebContentsImpl::GetAllWebContents(); | 96 WebContentsImpl::GetAllWebContents(); |
| 89 for (size_t i = 0; i < web_contents_vector.size(); ++i) | 97 for (size_t i = 0; i < web_contents_vector.size(); ++i) |
| 90 web_contents_vector[i]->SetAccessibilityMode(accessibility_mode()); | 98 web_contents_vector[i]->SetAccessibilityMode(accessibility_mode()); |
| 91 } | 99 } |
| 92 | 100 |
| 93 bool BrowserAccessibilityStateImpl::IsAccessibleBrowser() { | 101 bool BrowserAccessibilityStateImpl::IsAccessibleBrowser() { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 WebContentsImpl::GetAllWebContents(); | 165 WebContentsImpl::GetAllWebContents(); |
| 158 for (size_t i = 0; i < web_contents_vector.size(); ++i) { | 166 for (size_t i = 0; i < web_contents_vector.size(); ++i) { |
| 159 if (add) | 167 if (add) |
| 160 web_contents_vector[i]->AddAccessibilityMode(mode); | 168 web_contents_vector[i]->AddAccessibilityMode(mode); |
| 161 else | 169 else |
| 162 web_contents_vector[i]->RemoveAccessibilityMode(mode); | 170 web_contents_vector[i]->RemoveAccessibilityMode(mode); |
| 163 } | 171 } |
| 164 } | 172 } |
| 165 | 173 |
| 166 } // namespace content | 174 } // namespace content |
| OLD | NEW |