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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 407993003: Fix gesture handling for Views textfields (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')
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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) { 758 void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) {
759 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) { 759 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) {
760 select_all_on_gesture_tap_ = true; 760 select_all_on_gesture_tap_ = true;
761 761
762 // If we're trying to select all on tap, invalidate any saved selection lest 762 // If we're trying to select all on tap, invalidate any saved selection lest
763 // restoring it fights with the "select all" action. 763 // restoring it fights with the "select all" action.
764 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); 764 saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
765 } 765 }
766 766
767 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP) 767 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP)
768 SelectAll(false); 768 SelectAll(true);
769 769
770 if (event->type() == ui::ET_GESTURE_TAP || 770 if (event->type() == ui::ET_GESTURE_TAP ||
771 event->type() == ui::ET_GESTURE_TAP_CANCEL || 771 event->type() == ui::ET_GESTURE_TAP_CANCEL ||
772 event->type() == ui::ET_GESTURE_TWO_FINGER_TAP || 772 event->type() == ui::ET_GESTURE_TWO_FINGER_TAP ||
773 event->type() == ui::ET_GESTURE_SCROLL_BEGIN || 773 event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
774 event->type() == ui::ET_GESTURE_PINCH_BEGIN || 774 event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
775 event->type() == ui::ET_GESTURE_LONG_PRESS || 775 event->type() == ui::ET_GESTURE_LONG_PRESS ||
776 event->type() == ui::ET_GESTURE_LONG_TAP) { 776 event->type() == ui::ET_GESTURE_LONG_TAP) {
777 select_all_on_gesture_tap_ = false; 777 select_all_on_gesture_tap_ = false;
778 } 778 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 menu_contents->InsertItemWithStringIdAt( 1019 menu_contents->InsertItemWithStringIdAt(
1020 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); 1020 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL);
1021 } 1021 }
1022 1022
1023 // Minor note: We use IDC_ for command id here while the underlying textfield 1023 // Minor note: We use IDC_ for command id here while the underlying textfield
1024 // is using IDS_ for all its command ids. This is because views cannot depend 1024 // is using IDS_ for all its command ids. This is because views cannot depend
1025 // on IDC_ for now. 1025 // on IDC_ for now.
1026 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1026 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1027 IDS_EDIT_SEARCH_ENGINES); 1027 IDS_EDIT_SEARCH_ENGINES);
1028 } 1028 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698