summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc9
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h12
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup.cc9
3 files changed, 13 insertions, 17 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index fa60973..f9cd006 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -434,20 +434,21 @@ void AutocompleteEditModel::OnPopupDataChanged(
bool is_temporary_text,
const std::wstring& keyword,
bool is_keyword_hint,
- bool can_show_search_hint) {
+ AutocompleteMatch::Type type) {
// We don't want to show the search hint if we're showing a keyword hint or
// selected keyword, or (subtle!) if we would be showing a selected keyword
// but for keyword_ui_state_ == NO_KEYWORD.
- can_show_search_hint &= keyword.empty();
+ const bool show_search_hint = keyword.empty() &&
+ (type == AutocompleteMatch::SEARCH);
// Update keyword/hint-related local state.
bool keyword_state_changed = (keyword_ != keyword) ||
((is_keyword_hint_ != is_keyword_hint) && !keyword.empty()) ||
- (show_search_hint_ != can_show_search_hint);
+ (show_search_hint_ != show_search_hint);
if (keyword_state_changed) {
keyword_ = keyword;
is_keyword_hint_ = is_keyword_hint;
- show_search_hint_ = can_show_search_hint;
+ show_search_hint_ = show_search_hint;
}
// Handle changes to temporary text.
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index 15e3688..99309ef 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -260,22 +260,18 @@ class AutocompleteEditModel {
// |text| is either the new temporary text (if |is_temporary_text| is true)
// from the user manually selecting a different match, or the inline
// autocomplete text (if |is_temporary_text| is false).
- // |previous_selected_match| is only used when changing the temporary text;
- // it is the match that was (manually or automatically) selected before
- // the current manual selection, and is saved to be restored later if the
- // user hits <esc>.
- // |can_show_search_hint| is true if the current choice is nonexistent or a
- // search result; in these cases it may be OK to show the "Type to search"
- // hint (see comments on show_search_hint_).
// |keyword| is the keyword to show a hint for if |is_keyword_hint| is true,
// or the currently selected keyword if |is_keyword_hint| is false (see
// comments on keyword_ and is_keyword_hint_).
+ // |type| is the type of match selected; this is used to determine whether
+ // we can show the "Type to search" hint (see comments on
+ // show_search_hint_).
void OnPopupDataChanged(
const std::wstring& text,
bool is_temporary_text,
const std::wstring& keyword,
bool is_keyword_hint,
- bool can_show_search_hint);
+ AutocompleteMatch::Type type);
// Called by the AutocompleteEditView after something changes, with details
// about what state changes occured. Updates internal state, updates the
diff --git a/chrome/browser/autocomplete/autocomplete_popup.cc b/chrome/browser/autocomplete/autocomplete_popup.cc
index 9b61383..5a457c9 100644
--- a/chrome/browser/autocomplete/autocomplete_popup.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup.cc
@@ -751,8 +751,7 @@ void AutocompletePopupModel::SetSelectedLine(size_t line,
const bool is_keyword_hint = GetKeywordForMatch(match, &keyword);
edit_model_->OnPopupDataChanged(
reset_to_default ? std::wstring() : match.fill_into_edit,
- !reset_to_default, keyword, is_keyword_hint,
- (match.type == AutocompleteMatch::SEARCH));
+ !reset_to_default, keyword, is_keyword_hint, match.type);
// Repaint old and new selected lines immediately, so that the edit doesn't
// appear to update [much] faster than the popup. We must not update
@@ -952,7 +951,7 @@ void AutocompletePopupModel::Observe(NotificationType type,
std::wstring inline_autocomplete_text;
std::wstring keyword;
bool is_keyword_hint = false;
- bool can_show_search_hint = true;
+ AutocompleteMatch::Type type = AutocompleteMatch::SEARCH;
const AutocompleteResult::const_iterator match(result.default_match());
if (match != result.end()) {
if ((match->inline_autocomplete_offset != std::wstring::npos) &&
@@ -968,10 +967,10 @@ void AutocompletePopupModel::Observe(NotificationType type,
// the OS DNS cache could suffer eviction problems for minimal gain.
is_keyword_hint = GetKeywordForMatch(*match, &keyword);
- can_show_search_hint = (match->type == AutocompleteMatch::SEARCH);
+ type = match->type;
}
edit_model_->OnPopupDataChanged(inline_autocomplete_text, false, keyword,
- is_keyword_hint, can_show_search_hint);
+ is_keyword_hint, type);
return;
}