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

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: Address pkasting's comments. 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 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 if (event->type() != ui::ET_GESTURE_SHOW_PRESS)
202 select_all_on_gesture_tap_ = false;
202 } 203 }
203 204
204 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) { 205 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) {
205 location_bar_view_->GetAccessibleState(state); 206 location_bar_view_->GetAccessibleState(state);
206 state->role = ui::AccessibilityTypes::ROLE_TEXT; 207 state->role = ui::AccessibilityTypes::ROLE_TEXT;
207 } 208 }
208 209
209 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) { 210 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
210 select_all_on_mouse_release_ = 211 select_all_on_mouse_release_ =
211 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && 212 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 const string16 text(GetClipboardText()); 961 const string16 text(GetClipboardText());
961 if (!text.empty()) { 962 if (!text.empty()) {
962 // Record this paste, so we can do different behavior. 963 // Record this paste, so we can do different behavior.
963 model()->on_paste(); 964 model()->on_paste();
964 // Force a Paste operation to trigger the text_changed code in 965 // Force a Paste operation to trigger the text_changed code in
965 // OnAfterPossibleChange(), even if identical contents are pasted. 966 // OnAfterPossibleChange(), even if identical contents are pasted.
966 text_before_change_.clear(); 967 text_before_change_.clear();
967 InsertOrReplaceText(text); 968 InsertOrReplaceText(text);
968 } 969 }
969 } 970 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698