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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
9 #include "base/keyboard_codes.h" | 9 #include "base/keyboard_codes.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 } | 1069 } |
1070 | 1070 |
1071 void RenderWidgetHost::Replace(const string16& word) { | 1071 void RenderWidgetHost::Replace(const string16& word) { |
1072 Send(new ViewMsg_Replace(routing_id_, word)); | 1072 Send(new ViewMsg_Replace(routing_id_, word)); |
1073 } | 1073 } |
1074 | 1074 |
1075 void RenderWidgetHost::AdvanceToNextMisspelling() { | 1075 void RenderWidgetHost::AdvanceToNextMisspelling() { |
1076 Send(new ViewMsg_AdvanceToNextMisspelling(routing_id_)); | 1076 Send(new ViewMsg_AdvanceToNextMisspelling(routing_id_)); |
1077 } | 1077 } |
1078 | 1078 |
| 1079 void RenderWidgetHost::RequestAccessibilityTree() { |
| 1080 Send(new ViewMsg_GetAccessibilityTree(routing_id())); |
| 1081 } |
| 1082 |
| 1083 void RenderWidgetHost::SetAccessibilityFocus(int acc_obj_id) { |
| 1084 Send(new ViewMsg_SetAccessibilityFocus(routing_id(), acc_obj_id)); |
| 1085 } |
| 1086 |
| 1087 void RenderWidgetHost::AccessibilityDoDefaultAction(int acc_obj_id) { |
| 1088 Send(new ViewMsg_AccessibilityDoDefaultAction(routing_id(), acc_obj_id)); |
| 1089 } |
| 1090 |
1079 void RenderWidgetHost::ProcessKeyboardEventAck(int type, bool processed) { | 1091 void RenderWidgetHost::ProcessKeyboardEventAck(int type, bool processed) { |
1080 if (key_queue_.size() == 0) { | 1092 if (key_queue_.size() == 0) { |
1081 LOG(ERROR) << "Got a KeyEvent back from the renderer but we " | 1093 LOG(ERROR) << "Got a KeyEvent back from the renderer but we " |
1082 << "don't seem to have sent it to the renderer!"; | 1094 << "don't seem to have sent it to the renderer!"; |
1083 } else if (key_queue_.front().type != type) { | 1095 } else if (key_queue_.front().type != type) { |
1084 LOG(ERROR) << "We seem to have a different key type sent from " | 1096 LOG(ERROR) << "We seem to have a different key type sent from " |
1085 << "the renderer. (" << key_queue_.front().type << " vs. " | 1097 << "the renderer. (" << key_queue_.front().type << " vs. " |
1086 << type << "). Ignoring event."; | 1098 << type << "). Ignoring event."; |
1087 | 1099 |
1088 // Something must be wrong. Clear the |key_queue_| and | 1100 // Something must be wrong. Clear the |key_queue_| and |
1089 // |suppress_next_char_events_| so that we can resume from the error. | 1101 // |suppress_next_char_events_| so that we can resume from the error. |
1090 key_queue_.clear(); | 1102 key_queue_.clear(); |
1091 suppress_next_char_events_ = false; | 1103 suppress_next_char_events_ = false; |
1092 } else { | 1104 } else { |
1093 NativeWebKeyboardEvent front_item = key_queue_.front(); | 1105 NativeWebKeyboardEvent front_item = key_queue_.front(); |
1094 key_queue_.pop_front(); | 1106 key_queue_.pop_front(); |
1095 | 1107 |
1096 // We only send unprocessed key event upwards if we are not hidden, | 1108 // We only send unprocessed key event upwards if we are not hidden, |
1097 // because the user has moved away from us and no longer expect any effect | 1109 // because the user has moved away from us and no longer expect any effect |
1098 // of this key event. | 1110 // of this key event. |
1099 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1111 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
1100 UnhandledKeyboardEvent(front_item); | 1112 UnhandledKeyboardEvent(front_item); |
1101 | 1113 |
1102 // WARNING: This RenderWidgetHost can be deallocated at this point | 1114 // WARNING: This RenderWidgetHost can be deallocated at this point |
1103 // (i.e. in the case of Ctrl+W, where the call to | 1115 // (i.e. in the case of Ctrl+W, where the call to |
1104 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1116 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
1105 } | 1117 } |
1106 } | 1118 } |
1107 } | 1119 } |
OLD | NEW |