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

Side by Side Diff: components/omnibox/browser/omnibox_edit_model.h

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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 bool CommitSuggestedText(); 170 bool CommitSuggestedText();
171 171
172 // Invoked any time the text may have changed in the edit. Notifies the 172 // Invoked any time the text may have changed in the edit. Notifies the
173 // controller. 173 // controller.
174 void OnChanged(); 174 void OnChanged();
175 175
176 // Reverts the edit model back to its unedited state (permanent text showing, 176 // Reverts the edit model back to its unedited state (permanent text showing,
177 // no user input in progress). 177 // no user input in progress).
178 void Revert(); 178 void Revert();
179 179
180 // Directs the popup to start autocomplete. 180 // Directs the popup to start autocomplete. Makes use of the |view_| text and
181 // selection, so make sure to set those before calling StartAutocomplete().
181 void StartAutocomplete(bool has_selected_text, 182 void StartAutocomplete(bool has_selected_text,
182 bool prevent_inline_autocomplete); 183 bool prevent_inline_autocomplete);
183 184
184 // Closes the popup and cancels any pending asynchronous queries. 185 // Closes the popup and cancels any pending asynchronous queries.
185 void StopAutocomplete(); 186 void StopAutocomplete();
186 187
187 // Determines whether the user can "paste and go", given the specified text. 188 // Determines whether the user can "paste and go", given the specified text.
188 bool CanPasteAndGo(const base::string16& text) const; 189 bool CanPasteAndGo(const base::string16& text) const;
189 190
190 // Navigates to the destination last supplied to CanPasteAndGo. 191 // Navigates to the destination last supplied to CanPasteAndGo.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 bool is_keyword_selected() const { 238 bool is_keyword_selected() const {
238 return !is_keyword_hint_ && !keyword_.empty(); 239 return !is_keyword_hint_ && !keyword_.empty();
239 } 240 }
240 241
241 // Accepts the current keyword hint as a keyword. It always returns true for 242 // Accepts the current keyword hint as a keyword. It always returns true for
242 // caller convenience. |entered_method| indicates how the user entered 243 // caller convenience. |entered_method| indicates how the user entered
243 // keyword mode. 244 // keyword mode.
244 bool AcceptKeyword(KeywordModeEntryMethod entry_method); 245 bool AcceptKeyword(KeywordModeEntryMethod entry_method);
245 246
246 // Sets the current keyword to that of the user's default search provider and 247 // Sets the current keyword to that of the user's default search provider and
247 // updates the view so the user sees the keyword chip in the omnibox. 248 // updates the view so the user sees the keyword chip in the omnibox. Adjusts
249 // user_text_ and the selection based on the display text and the keyword
250 // entry method.
248 void EnterKeywordModeForDefaultSearchProvider( 251 void EnterKeywordModeForDefaultSearchProvider(
249 KeywordModeEntryMethod entry_method); 252 KeywordModeEntryMethod entry_method);
250 253
251 // Accepts the current temporary text as the user text. 254 // Accepts the current temporary text as the user text.
252 void AcceptTemporaryTextAsUserText(); 255 void AcceptTemporaryTextAsUserText();
253 256
254 // Clears the current keyword. 257 // Clears the current keyword.
255 void ClearKeyword(); 258 void ClearKeyword();
256 259
257 // Returns the current autocomplete result. This logic should in the future 260 // Returns the current autocomplete result. This logic should in the future
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 572
570 // The input that was sent to the AutocompleteController. Since no 573 // The input that was sent to the AutocompleteController. Since no
571 // autocomplete query is started after a tab switch, it is possible for this 574 // autocomplete query is started after a tab switch, it is possible for this
572 // |input_| to differ from the one currently stored in AutocompleteController. 575 // |input_| to differ from the one currently stored in AutocompleteController.
573 AutocompleteInput input_; 576 AutocompleteInput input_;
574 577
575 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); 578 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel);
576 }; 579 };
577 580
578 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ 581 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.cc ('k') | components/omnibox/browser/omnibox_edit_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698