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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 26869004: Merge 227483 "Views Textfield/Omnibox: Do not paste on Ctrl+Alt[..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1650/src/
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
===================================================================
--- chrome/browser/ui/views/omnibox/omnibox_view_views.cc (revision 227959)
+++ chrome/browser/ui/views/omnibox/omnibox_view_views.cc (working copy)
@@ -238,10 +238,12 @@
if (event.IsUnicodeKeyCode())
return views::Textfield::OnKeyPressed(event);
+ const bool shift = event.IsShiftDown();
+ const bool control = event.IsControlDown();
+ const bool alt = event.IsAltDown() || event.IsAltGrDown();
switch (event.key_code()) {
case ui::VKEY_RETURN:
- model()->AcceptInput(event.IsAltDown() ? NEW_FOREGROUND_TAB : CURRENT_TAB,
- false);
+ model()->AcceptInput(alt ? NEW_FOREGROUND_TAB : CURRENT_TAB, false);
return true;
case ui::VKEY_ESCAPE:
return model()->OnEscapeKeyPressed();
@@ -249,7 +251,7 @@
model()->OnControlKeyChanged(true);
break;
case ui::VKEY_DELETE:
- if (event.IsShiftDown() && model()->popup_model()->IsOpen())
+ if (shift && model()->popup_model()->IsOpen())
model()->popup_model()->TryDeletingCurrentItem();
break;
case ui::VKEY_UP:
@@ -259,21 +261,17 @@
model()->OnUpOrDownKeyPressed(1);
return true;
case ui::VKEY_PRIOR:
- if (event.IsControlDown() || event.IsAltDown() ||
- event.IsShiftDown()) {
+ if (control || alt || shift)
return false;
- }
model()->OnUpOrDownKeyPressed(-1 * model()->result().size());
return true;
case ui::VKEY_NEXT:
- if (event.IsControlDown() || event.IsAltDown() ||
- event.IsShiftDown()) {
+ if (control || alt || shift)
return false;
- }
model()->OnUpOrDownKeyPressed(model()->result().size());
return true;
case ui::VKEY_V:
- if (event.IsControlDown() && !read_only()) {
+ if (control && !alt && !read_only()) {
OnBeforePossibleChange();
OnPaste();
OnAfterPossibleChange();
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | ui/views/controls/textfield/native_textfield_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698