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

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

Issue 26248004: Views Textfield/Omnibox: Do not paste on Ctrl+Alt[Gr]+V or AltGr+V. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify test comments. 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
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 0362f4932b8168c439b3c2d993baad4bf724f26d..e38496d310ae371d619587841fae0a04b6dfc496 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -257,10 +257,12 @@ bool OmniboxViewViews::OnKeyPressed(const ui::KeyEvent& event) {
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();
@@ -268,7 +270,7 @@ bool OmniboxViewViews::OnKeyPressed(const ui::KeyEvent& event) {
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:
@@ -278,21 +280,17 @@ bool OmniboxViewViews::OnKeyPressed(const ui::KeyEvent& event) {
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