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

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: 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
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) { 194 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) {
195 select_all_on_gesture_tap_ = true; 195 select_all_on_gesture_tap_ = true;
196 196
197 // If we're trying to select all on tap, invalidate any saved selection lest 197 // If we're trying to select all on tap, invalidate any saved selection lest
198 // restoring it fights with the "select all" action. 198 // restoring it fights with the "select all" action.
199 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); 199 saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
200 return; 200 return;
201 } 201 }
202 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP) 202 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP)
203 SelectAll(false); 203 SelectAll(false);
204 select_all_on_gesture_tap_ = false; 204 if (event->type() != ui::ET_GESTURE_SHOW_PRESS)
205 select_all_on_gesture_tap_ = false;
205 } 206 }
206 207
207 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) { 208 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) {
208 location_bar_view_->GetAccessibleState(state); 209 location_bar_view_->GetAccessibleState(state);
209 state->role = ui::AccessibilityTypes::ROLE_TEXT; 210 state->role = ui::AccessibilityTypes::ROLE_TEXT;
210 } 211 }
211 212
212 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) { 213 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
213 select_all_on_mouse_release_ = 214 select_all_on_mouse_release_ =
214 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && 215 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 const string16 text(GetClipboardText()); 964 const string16 text(GetClipboardText());
964 if (!text.empty()) { 965 if (!text.empty()) {
965 // Record this paste, so we can do different behavior. 966 // Record this paste, so we can do different behavior.
966 model()->on_paste(); 967 model()->on_paste();
967 // Force a Paste operation to trigger the text_changed code in 968 // Force a Paste operation to trigger the text_changed code in
968 // OnAfterPossibleChange(), even if identical contents are pasted. 969 // OnAfterPossibleChange(), even if identical contents are pasted.
969 text_before_change_.clear(); 970 text_before_change_.clear();
970 InsertOrReplaceText(text); 971 InsertOrReplaceText(text);
971 } 972 }
972 } 973 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698