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 |
132 RenderWidgetHost::List widgets = RenderWidgetHost::GetRenderWidgetHosts(); | |
133 for (RenderWidgetHost::List::const_iterator it = widgets.begin(); | |
jam
2013/06/12 19:59:59
ditto
nasko
2013/06/12 21:18:59
Done.
| |
134 it != widgets.end(); ++it) { | |
135 const RenderWidgetHost* widget = *it; | |
136 // Ignore processes that don't have a connection, such as crashed tabs. | 136 // Ignore processes that don't have a connection, such as crashed tabs. |
137 if (!render_process_host->HasConnection()) | 137 if (!widget->GetProcess()->HasConnection()) |
138 continue; | |
139 if (!widget->IsRenderView()) | |
138 continue; | 140 continue; |
139 | 141 |
140 for (RenderProcessHost::RenderWidgetHostsIterator rwit( | 142 RenderWidgetHostImpl* rwhi = |
141 render_process_host->GetRenderWidgetHostsIterator()); | 143 RenderWidgetHostImpl::From(const_cast<RenderWidgetHost*>(widget)); |
jam
2013/06/12 19:59:59
you'd get rid of the const cast after switching to
nasko
2013/06/12 21:18:59
Done.
| |
142 !rwit.IsAtEnd(); | 144 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 } | 145 } |
153 } | 146 } |
154 | 147 |
155 } // namespace content | 148 } // namespace content |
OLD | NEW |