Index: chrome/browser/autocomplete/autocomplete_edit.h |
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h |
index 83c87c3965c8071353fda18c431c032c6914793c..866be3a1e476045c39614d404d2c397c7806a624 100644 |
--- a/chrome/browser/autocomplete/autocomplete_edit.h |
+++ b/chrome/browser/autocomplete/autocomplete_edit.h |
@@ -105,32 +105,17 @@ class AutocompleteEditController { |
class AutocompleteEditModel : public NotificationObserver { |
public: |
- enum KeywordUIState { |
- // The user is typing normally. |
- NORMAL, |
- // The user is editing in the middle of the input string. Even if the |
- // input looks like a keyword, don't display the keyword UI, as to not |
- // interfere with the user's editing. |
- NO_KEYWORD, |
- // The user has triggered the keyword UI. Until it disappears, bias |
- // autocomplete results so that input strings of the keyword alone default |
- // to the keyword provider, not a normal navigation or search. |
- KEYWORD, |
- }; |
- |
struct State { |
State(bool user_input_in_progress, |
const std::wstring& user_text, |
const std::wstring& keyword, |
- bool is_keyword_hint, |
- KeywordUIState keyword_ui_state); |
+ bool is_keyword_hint); |
~State(); |
bool user_input_in_progress; |
const std::wstring user_text; |
const std::wstring keyword; |
const bool is_keyword_hint; |
- const KeywordUIState keyword_ui_state; |
}; |
AutocompleteEditModel(AutocompleteEditView* view, |
@@ -258,10 +243,7 @@ class AutocompleteEditModel : public NotificationObserver { |
// Accessors for keyword-related state (see comments on keyword_ and |
// is_keyword_hint_). |
- std::wstring keyword() const { |
- return (is_keyword_hint_ || (keyword_ui_state_ != NO_KEYWORD)) ? |
- keyword_ : std::wstring(); |
- } |
+ const std::wstring& keyword() const { return keyword_; } |
bool is_keyword_hint() const { return is_keyword_hint_; } |
// Accepts the current keyword hint as a keyword. |
@@ -297,8 +279,9 @@ class AutocompleteEditModel : public NotificationObserver { |
// necessary. |
void OnControlKeyChanged(bool pressed); |
- // Called when the user pastes in text that replaces the entire edit contents. |
- void on_paste_replacing_all() { paste_state_ = REPLACING_ALL; } |
+ // Called when the user pastes in text. |replacing_all| should be true if the |
+ // entire edit contents is being replaced. |
+ void OnPaste(bool replacing_all); |
// Called when the user presses up or down. |count| is a repeat count, |
// negative for moving up, positive for moving down. |
@@ -353,6 +336,8 @@ class AutocompleteEditModel : public NotificationObserver { |
// for every edit. If OnPaste() set the state directly to |
// REPLACED_ALL, OnAfterPossibleChange() wouldn't know |
// whether that represented the current edit or a past one. |
+ PASTED, // Most recent edit was a normal paste. |
+ PASTING, // Like REPLACING_ALL, but indicating a normal paste. |
}; |
enum ControlKeyState { |
@@ -403,6 +388,10 @@ class AutocompleteEditModel : public NotificationObserver { |
// on the controller. |
void UpdateSuggestedSearchText(); |
+ // Accepts current keyword if the user only typed a whitespace at the end of |
Peter Kasting
2011/01/20 00:04:22
Nit: whitespace -> space
James Su
2011/01/20 06:49:31
Done.
|
+ // |new_user_text|. Returns true if the current keyword is accepted. |
+ bool MaybeAcceptKeywordBySpace(const std::wstring& new_user_text); |
+ |
AutocompleteEditView* view_; |
AutocompletePopupModel* popup_; |
@@ -471,7 +460,6 @@ class AutocompleteEditModel : public NotificationObserver { |
// them and not revert all the way to the permanent_text_. |
bool has_temporary_text_; |
GURL original_url_; |
- KeywordUIState original_keyword_ui_state_; |
// When the user's last action was to paste and replace all the text, we |
// disallow inline autocomplete (on the theory that the user is trying to |
@@ -495,9 +483,6 @@ class AutocompleteEditModel : public NotificationObserver { |
// keyword_ to show a "Press <tab> to search" sort of hint. |
bool is_keyword_hint_; |
- // See KeywordUIState enum. |
- KeywordUIState keyword_ui_state_; |
- |
// Paste And Go-related state. See CanPasteAndGo(). |
mutable GURL paste_and_go_url_; |
mutable PageTransition::Type paste_and_go_transition_; |