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

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

Issue 2435103002: Omnibox: Preserve display text and select all on a focus search (Closed)
Patch Set: Use display_text.length() as caret pos for KEYBOARD_SHORTCUT Created 4 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 <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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 240 }
241 241
242 void OmniboxViewViews::SetUserText(const base::string16& text, 242 void OmniboxViewViews::SetUserText(const base::string16& text,
243 bool update_popup) { 243 bool update_popup) {
244 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); 244 saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
245 OmniboxView::SetUserText(text, update_popup); 245 OmniboxView::SetUserText(text, update_popup);
246 } 246 }
247 247
248 void OmniboxViewViews::EnterKeywordModeForDefaultSearchProvider() { 248 void OmniboxViewViews::EnterKeywordModeForDefaultSearchProvider() {
249 // Transition the user into keyword mode using their default search provider. 249 // Transition the user into keyword mode using their default search provider.
250 // Select their query if they typed one.
251 model()->EnterKeywordModeForDefaultSearchProvider( 250 model()->EnterKeywordModeForDefaultSearchProvider(
252 KeywordModeEntryMethod::KEYBOARD_SHORTCUT); 251 KeywordModeEntryMethod::KEYBOARD_SHORTCUT);
253 SelectRange(gfx::Range(text().size(), 0));
254 } 252 }
255 253
256 void OmniboxViewViews::GetSelectionBounds( 254 void OmniboxViewViews::GetSelectionBounds(
257 base::string16::size_type* start, 255 base::string16::size_type* start,
258 base::string16::size_type* end) const { 256 base::string16::size_type* end) const {
259 const gfx::Range range = GetSelectedRange(); 257 const gfx::Range range = GetSelectedRange();
260 *start = static_cast<size_t>(range.start()); 258 *start = static_cast<size_t>(range.start());
261 *end = static_cast<size_t>(range.end()); 259 *end = static_cast<size_t>(range.end());
262 } 260 }
263 261
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); 1072 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
1075 1073
1076 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); 1074 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR);
1077 1075
1078 // Minor note: We use IDC_ for command id here while the underlying textfield 1076 // Minor note: We use IDC_ for command id here while the underlying textfield
1079 // is using IDS_ for all its command ids. This is because views cannot depend 1077 // is using IDS_ for all its command ids. This is because views cannot depend
1080 // on IDC_ for now. 1078 // on IDC_ for now.
1081 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1079 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1082 IDS_EDIT_SEARCH_ENGINES); 1080 IDS_EDIT_SEARCH_ENGINES);
1083 } 1081 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | components/omnibox/browser/omnibox_edit_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698