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

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

Issue 55893004: Omnibox selects all text on tap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win aura test. Created 7 years, 1 month 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 | chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) { 191 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) {
192 select_all_on_gesture_tap_ = true; 192 select_all_on_gesture_tap_ = true;
193 193
194 // If we're trying to select all on tap, invalidate any saved selection lest 194 // If we're trying to select all on tap, invalidate any saved selection lest
195 // restoring it fights with the "select all" action. 195 // restoring it fights with the "select all" action.
196 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); 196 saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
197 return; 197 return;
198 } 198 }
199 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP) 199 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP)
200 SelectAll(false); 200 SelectAll(false);
201 select_all_on_gesture_tap_ = false; 201
202 if (event->type() == ui::ET_GESTURE_TAP ||
203 event->type() == ui::ET_GESTURE_TAP_CANCEL ||
204 event->type() == ui::ET_GESTURE_TWO_FINGER_TAP ||
205 event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
206 event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
207 event->type() == ui::ET_GESTURE_LONG_PRESS ||
208 event->type() == ui::ET_GESTURE_LONG_TAP) {
209 select_all_on_gesture_tap_ = false;
210 }
202 } 211 }
203 212
204 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) { 213 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) {
205 location_bar_view_->GetAccessibleState(state); 214 location_bar_view_->GetAccessibleState(state);
206 state->role = ui::AccessibilityTypes::ROLE_TEXT; 215 state->role = ui::AccessibilityTypes::ROLE_TEXT;
207 } 216 }
208 217
209 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) { 218 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
210 select_all_on_mouse_release_ = 219 select_all_on_mouse_release_ =
211 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && 220 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 const string16 text(GetClipboardText()); 969 const string16 text(GetClipboardText());
961 if (!text.empty()) { 970 if (!text.empty()) {
962 // Record this paste, so we can do different behavior. 971 // Record this paste, so we can do different behavior.
963 model()->on_paste(); 972 model()->on_paste();
964 // Force a Paste operation to trigger the text_changed code in 973 // Force a Paste operation to trigger the text_changed code in
965 // OnAfterPossibleChange(), even if identical contents are pasted. 974 // OnAfterPossibleChange(), even if identical contents are pasted.
966 text_before_change_.clear(); 975 text_before_change_.clear();
967 InsertOrReplaceText(text); 976 InsertOrReplaceText(text);
968 } 977 }
969 } 978 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698