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

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

Issue 2747583004: Don't leave a caret selection after RevertAll. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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 <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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 *end = static_cast<size_t>(range.end()); 253 *end = static_cast<size_t>(range.end());
254 } 254 }
255 255
256 void OmniboxViewViews::SelectAll(bool reversed) { 256 void OmniboxViewViews::SelectAll(bool reversed) {
257 views::Textfield::SelectAll(reversed); 257 views::Textfield::SelectAll(reversed);
258 } 258 }
259 259
260 void OmniboxViewViews::RevertAll() { 260 void OmniboxViewViews::RevertAll() {
261 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); 261 saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
262 OmniboxView::RevertAll(); 262 OmniboxView::RevertAll();
263 SelectAll(true);
263 } 264 }
264 265
265 void OmniboxViewViews::SetFocus() { 266 void OmniboxViewViews::SetFocus() {
266 RequestFocus(); 267 RequestFocus();
267 // Restore caret visibility if focus is explicitly requested. This is 268 // Restore caret visibility if focus is explicitly requested. This is
268 // necessary because if we already have invisible focus, the RequestFocus() 269 // necessary because if we already have invisible focus, the RequestFocus()
269 // call above will short-circuit, preventing us from reaching 270 // call above will short-circuit, preventing us from reaching
270 // OmniboxEditModel::OnSetFocus(), which handles restoring visibility when the 271 // OmniboxEditModel::OnSetFocus(), which handles restoring visibility when the
271 // omnibox regains focus after losing focus. 272 // omnibox regains focus after losing focus.
272 model()->SetCaretVisibility(true); 273 model()->SetCaretVisibility(true);
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); 1059 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
1059 1060
1060 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); 1061 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR);
1061 1062
1062 // Minor note: We use IDC_ for command id here while the underlying textfield 1063 // Minor note: We use IDC_ for command id here while the underlying textfield
1063 // is using IDS_ for all its command ids. This is because views cannot depend 1064 // is using IDS_ for all its command ids. This is because views cannot depend
1064 // on IDC_ for now. 1065 // on IDC_ for now.
1065 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1066 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1066 IDS_EDIT_SEARCH_ENGINES); 1067 IDS_EDIT_SEARCH_ENGINES);
1067 } 1068 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698