OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer_host/render_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 } | 1131 } |
1132 | 1132 |
1133 void RenderWidgetHost::Replace(const string16& word) { | 1133 void RenderWidgetHost::Replace(const string16& word) { |
1134 Send(new ViewMsg_Replace(routing_id_, word)); | 1134 Send(new ViewMsg_Replace(routing_id_, word)); |
1135 } | 1135 } |
1136 | 1136 |
1137 void RenderWidgetHost::AdvanceToNextMisspelling() { | 1137 void RenderWidgetHost::AdvanceToNextMisspelling() { |
1138 Send(new ViewMsg_AdvanceToNextMisspelling(routing_id_)); | 1138 Send(new ViewMsg_AdvanceToNextMisspelling(routing_id_)); |
1139 } | 1139 } |
1140 | 1140 |
1141 void RenderWidgetHost::RequestAccessibilityTree() { | |
1142 Send(new ViewMsg_GetAccessibilityTree(routing_id())); | |
1143 } | |
1144 | |
1145 void RenderWidgetHost::SetDocumentLoaded(bool document_loaded) { | |
1146 document_loaded_ = document_loaded; | |
1147 | |
1148 if (!document_loaded_) | |
1149 requested_accessibility_tree_ = false; | |
1150 | |
1151 if (renderer_accessible_ && document_loaded_) { | |
1152 RequestAccessibilityTree(); | |
1153 requested_accessibility_tree_ = true; | |
1154 } | |
1155 } | |
1156 | |
1157 void RenderWidgetHost::EnableRendererAccessibility() { | 1141 void RenderWidgetHost::EnableRendererAccessibility() { |
1158 if (renderer_accessible_) | 1142 if (renderer_accessible_) |
1159 return; | 1143 return; |
1160 | 1144 |
1161 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1145 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1162 switches::kDisableRendererAccessibility)) { | 1146 switches::kDisableRendererAccessibility)) { |
1163 return; | 1147 return; |
1164 } | 1148 } |
1165 | 1149 |
1166 renderer_accessible_ = true; | 1150 renderer_accessible_ = true; |
1167 | 1151 |
1168 if (document_loaded_ && !requested_accessibility_tree_) { | 1152 if (process_->HasConnection()) { |
1169 RequestAccessibilityTree(); | 1153 // Renderer accessibility wasn't enabled on process launch. Enable it now. |
1170 requested_accessibility_tree_ = true; | 1154 Send(new ViewMsg_EnableAccessibility(routing_id())); |
1171 } | 1155 } |
1172 } | 1156 } |
1173 | 1157 |
1174 void RenderWidgetHost::SetAccessibilityFocus(int acc_obj_id) { | 1158 void RenderWidgetHost::SetAccessibilityFocus(int acc_obj_id) { |
1175 Send(new ViewMsg_SetAccessibilityFocus(routing_id(), acc_obj_id)); | 1159 Send(new ViewMsg_SetAccessibilityFocus(routing_id(), acc_obj_id)); |
1176 } | 1160 } |
1177 | 1161 |
1178 void RenderWidgetHost::AccessibilityDoDefaultAction(int acc_obj_id) { | 1162 void RenderWidgetHost::AccessibilityDoDefaultAction(int acc_obj_id) { |
1179 Send(new ViewMsg_AccessibilityDoDefaultAction(routing_id(), acc_obj_id)); | 1163 Send(new ViewMsg_AccessibilityDoDefaultAction(routing_id(), acc_obj_id)); |
1180 } | 1164 } |
(...skipping 24 matching lines...) Expand all Loading... |
1205 // of this key event. | 1189 // of this key event. |
1206 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1190 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
1207 UnhandledKeyboardEvent(front_item); | 1191 UnhandledKeyboardEvent(front_item); |
1208 | 1192 |
1209 // WARNING: This RenderWidgetHost can be deallocated at this point | 1193 // WARNING: This RenderWidgetHost can be deallocated at this point |
1210 // (i.e. in the case of Ctrl+W, where the call to | 1194 // (i.e. in the case of Ctrl+W, where the call to |
1211 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1195 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
1212 } | 1196 } |
1213 } | 1197 } |
1214 } | 1198 } |
OLD | NEW |