Chromium Code Reviews| 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/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 // RawKeyDown event may generate multiple Char events, so we can't reset | 873 // RawKeyDown event may generate multiple Char events, so we can't reset |
| 874 // |suppress_next_char_events_| until we get a KeyUp or a RawKeyDown. | 874 // |suppress_next_char_events_| until we get a KeyUp or a RawKeyDown. |
| 875 if (key_event.type == WebKeyboardEvent::Char) | 875 if (key_event.type == WebKeyboardEvent::Char) |
| 876 return; | 876 return; |
| 877 // We get a KeyUp or a RawKeyDown event. | 877 // We get a KeyUp or a RawKeyDown event. |
| 878 suppress_next_char_events_ = false; | 878 suppress_next_char_events_ = false; |
| 879 } | 879 } |
| 880 | 880 |
| 881 bool is_keyboard_shortcut = false; | 881 bool is_keyboard_shortcut = false; |
| 882 // Only pre-handle the key event if it's not handled by the input method. | 882 // Only pre-handle the key event if it's not handled by the input method. |
| 883 if (!key_event.skip_in_browser) { | 883 // Looking extensively for over a day, a delegate_ of NULL seems |
|
brettw
2012/07/23 17:44:45
This comment isn't clear when not in the context o
Mr4D (OOO till 08-26)
2012/07/23 21:46:17
Done.
| |
| 884 // impossible. But (crbug/134465) has shown that it can happen in some | |
| 885 // non reproducible cases. With v22 this problem did not show anymore so | |
| 886 // that we can get rid of this 'fix' later. | |
| 887 if (delegate_ && !key_event.skip_in_browser) { | |
| 884 // We need to set |suppress_next_char_events_| to true if | 888 // We need to set |suppress_next_char_events_| to true if |
| 885 // PreHandleKeyboardEvent() returns true, but |this| may already be | 889 // PreHandleKeyboardEvent() returns true, but |this| may already be |
| 886 // destroyed at that time. So set |suppress_next_char_events_| true here, | 890 // destroyed at that time. So set |suppress_next_char_events_| true here, |
| 887 // then revert it afterwards when necessary. | 891 // then revert it afterwards when necessary. |
| 888 if (key_event.type == WebKeyboardEvent::RawKeyDown) | 892 if (key_event.type == WebKeyboardEvent::RawKeyDown) |
| 889 suppress_next_char_events_ = true; | 893 suppress_next_char_events_ = true; |
| 890 | 894 |
| 891 // Tab switching/closing accelerators aren't sent to the renderer to avoid | 895 // Tab switching/closing accelerators aren't sent to the renderer to avoid |
| 892 // a hung/malicious renderer from interfering. | 896 // a hung/malicious renderer from interfering. |
| 893 if (delegate_->PreHandleKeyboardEvent(key_event, &is_keyboard_shortcut)) | 897 if (delegate_->PreHandleKeyboardEvent(key_event, &is_keyboard_shortcut)) |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1908 // indicate that no callback is in progress (i.e. without this line | 1912 // indicate that no callback is in progress (i.e. without this line |
| 1909 // DelayedAutoResized will not get called again). | 1913 // DelayedAutoResized will not get called again). |
| 1910 new_auto_size_.SetSize(0, 0); | 1914 new_auto_size_.SetSize(0, 0); |
| 1911 if (!should_auto_resize_) | 1915 if (!should_auto_resize_) |
| 1912 return; | 1916 return; |
| 1913 | 1917 |
| 1914 OnRenderAutoResized(new_size); | 1918 OnRenderAutoResized(new_size); |
| 1915 } | 1919 } |
| 1916 | 1920 |
| 1917 } // namespace content | 1921 } // namespace content |
| OLD | NEW |