Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1221083008: [NOT FOR COMMIT] Ignore inserting characters of Keys with modifiers on CrOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Preventing insertion of keys with modifiers in WebContents Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 void RenderWidgetHostViewAura::InsertChar(base::char16 ch, int flags) { 1578 void RenderWidgetHostViewAura::InsertChar(base::char16 ch, int flags) {
1579 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { 1579 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) {
1580 popup_child_host_view_->InsertChar(ch, flags); 1580 popup_child_host_view_->InsertChar(ch, flags);
1581 return; 1581 return;
1582 } 1582 }
1583 1583
1584 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 1584 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547
1585 if (host_ && (accept_return_character_ || ch != ui::VKEY_RETURN)) { 1585 if (host_ && (accept_return_character_ || ch != ui::VKEY_RETURN)) {
1586 double now = ui::EventTimeForNow().InSecondsF(); 1586 double now = ui::EventTimeForNow().InSecondsF();
1587 // Send a blink::WebInputEvent::Char event to |host_|. 1587 // Send a blink::WebInputEvent::Char event to |host_|.
1588 // On ChromeOS we send a blink::WebInputEvent::Char event only if no
1589 // modifiers are currently pressed. Otherwise |is_char| will be false and we
1590 // will end up sending a blink::WebInputEvent::RawKeyDown event.
1591 #if defined(OS_CHROMEOS)
afakhry 2015/08/14 20:18:55 I'm not sure if we want to ignore keys with modifi
1592 const int kControlModifierMask = ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN |
1593 ui::EF_COMMAND_DOWN;
1594 #else
1595 const int kControlModifierMask = ui::EF_NONE;
1596 #endif // defined(OS_CHROMEOS)
1597 const bool is_char = (flags & kControlModifierMask) == 0;
1598
1588 NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED, 1599 NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED,
1589 true /* is_char */, 1600 is_char,
dtapuska 2015/09/03 15:27:12 This doesn't seem correct to me. This is going to
afakhry 2015/09/03 17:34:03 You are right, I used to get two keydowns. I chang
1590 ch, 1601 ch,
1591 flags, 1602 flags,
1592 now); 1603 now);
1593 ForwardKeyboardEvent(webkit_event); 1604 ForwardKeyboardEvent(webkit_event);
1594 } 1605 }
1595 } 1606 }
1596 1607
1597 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { 1608 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
1598 return text_input_type_; 1609 return text_input_type_;
1599 } 1610 }
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 2830
2820 //////////////////////////////////////////////////////////////////////////////// 2831 ////////////////////////////////////////////////////////////////////////////////
2821 // RenderWidgetHostViewBase, public: 2832 // RenderWidgetHostViewBase, public:
2822 2833
2823 // static 2834 // static
2824 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2835 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2825 GetScreenInfoForWindow(results, NULL); 2836 GetScreenInfoForWindow(results, NULL);
2826 } 2837 }
2827 2838
2828 } // namespace content 2839 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698