| 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.h" | 9 #include "base/timer.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 #if !defined(OS_WIN) | 121 #if !defined(OS_WIN) |
| 122 void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { | 122 void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { |
| 123 } | 123 } |
| 124 #endif | 124 #endif |
| 125 | 125 |
| 126 void BrowserAccessibilityStateImpl::SetAccessibilityMode( | 126 void BrowserAccessibilityStateImpl::SetAccessibilityMode( |
| 127 AccessibilityMode mode) { | 127 AccessibilityMode mode) { |
| 128 if (accessibility_mode_ == mode) | 128 if (accessibility_mode_ == mode) |
| 129 return; | 129 return; |
| 130 accessibility_mode_ = mode; | 130 accessibility_mode_ = mode; |
| 131 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); | |
| 132 !it.IsAtEnd(); it.Advance()) { | |
| 133 RenderProcessHost* render_process_host = it.GetCurrentValue(); | |
| 134 DCHECK(render_process_host); | |
| 135 | 131 |
| 136 // Ignore processes that don't have a connection, such as crashed tabs. | 132 scoped_ptr<RenderWidgetHost::List> hosts = |
| 137 if (!render_process_host->HasConnection()) | 133 RenderWidgetHost::GetRenderWidgetHosts(); |
| 138 continue; | 134 for (RenderWidgetHost::List::const_iterator it = hosts->begin(); |
| 135 it != hosts->end(); |
| 136 ++it) { |
| 137 const RenderWidgetHost* widget = *it; |
| 138 if (!widget->IsRenderView()) |
| 139 continue; |
| 139 | 140 |
| 140 for (RenderProcessHost::RenderWidgetHostsIterator rwit( | 141 RenderWidgetHostImpl* rwhi = |
| 141 render_process_host->GetRenderWidgetHostsIterator()); | 142 RenderWidgetHostImpl::From(const_cast<RenderWidgetHost*>(widget)); |
| 142 !rwit.IsAtEnd(); | 143 rwhi->SetAccessibilityMode(mode); |
| 143 rwit.Advance()) { | |
| 144 RenderWidgetHost* rwh = const_cast<RenderWidgetHost*>( | |
| 145 rwit.GetCurrentValue()); | |
| 146 DCHECK(rwh); | |
| 147 if (!rwh || !rwh->IsRenderView()) | |
| 148 continue; | |
| 149 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); | |
| 150 rwhi->SetAccessibilityMode(mode); | |
| 151 } | |
| 152 } | 144 } |
| 153 } | 145 } |
| 154 | 146 |
| 155 } // namespace content | 147 } // namespace content |
| OLD | NEW |