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

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

Issue 2510373003: Cleanup: Remove "gray text" logic from Omnibox (Closed)
Patch Set: review2 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // the Fakebox? 53 // the Fakebox?
54 enum FocusSource { 54 enum FocusSource {
55 INVALID = 0, 55 INVALID = 0,
56 OMNIBOX = 1, 56 OMNIBOX = 1,
57 FAKEBOX = 2 57 FAKEBOX = 2
58 }; 58 };
59 59
60 struct State { 60 struct State {
61 State(bool user_input_in_progress, 61 State(bool user_input_in_progress,
62 const base::string16& user_text, 62 const base::string16& user_text,
63 const base::string16& gray_text,
64 const base::string16& keyword, 63 const base::string16& keyword,
65 bool is_keyword_hint, 64 bool is_keyword_hint,
66 KeywordModeEntryMethod keyword_mode_entry_method, 65 KeywordModeEntryMethod keyword_mode_entry_method,
67 OmniboxFocusState focus_state, 66 OmniboxFocusState focus_state,
68 FocusSource focus_source, 67 FocusSource focus_source,
69 const AutocompleteInput& autocomplete_input); 68 const AutocompleteInput& autocomplete_input);
70 State(const State& other); 69 State(const State& other);
71 ~State(); 70 ~State();
72 71
73 bool user_input_in_progress; 72 bool user_input_in_progress;
74 const base::string16 user_text; 73 const base::string16 user_text;
75 const base::string16 gray_text;
76 const base::string16 keyword; 74 const base::string16 keyword;
77 const bool is_keyword_hint; 75 const bool is_keyword_hint;
78 KeywordModeEntryMethod keyword_mode_entry_method; 76 KeywordModeEntryMethod keyword_mode_entry_method;
79 OmniboxFocusState focus_state; 77 OmniboxFocusState focus_state;
80 FocusSource focus_source; 78 FocusSource focus_source;
81 const AutocompleteInput autocomplete_input; 79 const AutocompleteInput autocomplete_input;
82 }; 80 };
83 81
84 OmniboxEditModel(OmniboxView* view, 82 OmniboxEditModel(OmniboxView* view,
85 OmniboxEditController* controller, 83 OmniboxEditController* controller,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // immediately user-visible, because either the user is not editing or the 155 // immediately user-visible, because either the user is not editing or the
158 // edit does not have focus. 156 // edit does not have focus.
159 bool UpdatePermanentText(); 157 bool UpdatePermanentText();
160 158
161 // Returns the URL corresponding to the permanent text. 159 // Returns the URL corresponding to the permanent text.
162 GURL PermanentURL() const; 160 GURL PermanentURL() const;
163 161
164 // Sets the user_text_ to |text|. Only the View should call this. 162 // Sets the user_text_ to |text|. Only the View should call this.
165 void SetUserText(const base::string16& text); 163 void SetUserText(const base::string16& text);
166 164
167 // Commits the gray suggested text as if it's been input by the user.
168 // Returns true if the text was committed.
169 // TODO: can the return type be void?
170 bool CommitSuggestedText();
171
172 // Invoked any time the text may have changed in the edit. Notifies the 165 // Invoked any time the text may have changed in the edit. Notifies the
173 // controller. 166 // controller.
174 void OnChanged(); 167 void OnChanged();
175 168
176 // Reverts the edit model back to its unedited state (permanent text showing, 169 // Reverts the edit model back to its unedited state (permanent text showing,
177 // no user input in progress). 170 // no user input in progress).
178 void Revert(); 171 void Revert();
179 172
180 // Directs the popup to start autocomplete. Makes use of the |view_| text and 173 // Directs the popup to start autocomplete. Makes use of the |view_| text and
181 // selection, so make sure to set those before calling StartAutocomplete(). 174 // selection, so make sure to set those before calling StartAutocomplete().
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // Called when the user presses or releases the control key. Changes state as 291 // Called when the user presses or releases the control key. Changes state as
299 // necessary. 292 // necessary.
300 void OnControlKeyChanged(bool pressed); 293 void OnControlKeyChanged(bool pressed);
301 294
302 // Called when the user pastes in text. 295 // Called when the user pastes in text.
303 void OnPaste(); 296 void OnPaste();
304 297
305 // Returns true if pasting is in progress. 298 // Returns true if pasting is in progress.
306 bool is_pasting() const { return paste_state_ == PASTING; } 299 bool is_pasting() const { return paste_state_ == PASTING; }
307 300
308 // TODO(beaudoin): Try not to expose this.
309 bool in_revert() const { return in_revert_; }
310
311 // Called when the user presses up or down. |count| is a repeat count, 301 // Called when the user presses up or down. |count| is a repeat count,
312 // negative for moving up, positive for moving down. 302 // negative for moving up, positive for moving down.
313 virtual void OnUpOrDownKeyPressed(int count); 303 virtual void OnUpOrDownKeyPressed(int count);
314 304
315 // Called when any relevant data changes. This rolls together several 305 // Called when any relevant data changes. This rolls together several
316 // separate pieces of data into one call so we can update all the UI 306 // separate pieces of data into one call so we can update all the UI
317 // efficiently: 307 // efficiently:
318 // |text| is either the new temporary text from the user manually selecting 308 // |text| is either the new temporary text from the user manually selecting
319 // a different match, or the inline autocomplete text. We distinguish by 309 // a different match, or the inline autocomplete text. We distinguish by
320 // checking if |destination_for_temporary_text_change| is NULL. 310 // checking if |destination_for_temporary_text_change| is NULL.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 562
573 // The input that was sent to the AutocompleteController. Since no 563 // The input that was sent to the AutocompleteController. Since no
574 // autocomplete query is started after a tab switch, it is possible for this 564 // autocomplete query is started after a tab switch, it is possible for this
575 // |input_| to differ from the one currently stored in AutocompleteController. 565 // |input_| to differ from the one currently stored in AutocompleteController.
576 AutocompleteInput input_; 566 AutocompleteInput input_;
577 567
578 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); 568 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel);
579 }; 569 };
580 570
581 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ 571 #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