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

Unified Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 18119005: Misc. cleanup: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/omnibox/omnibox_edit_model.cc
===================================================================
--- chrome/browser/ui/omnibox/omnibox_edit_model.cc (revision 208964)
+++ chrome/browser/ui/omnibox/omnibox_edit_model.cc (working copy)
@@ -896,24 +896,7 @@
void OmniboxEditModel::OnUpOrDownKeyPressed(int count) {
// NOTE: This purposefully doesn't trigger any code that resets paste_state_.
- if (!popup_model()->IsOpen()) {
- if (!query_in_progress()) {
- // The popup is neither open nor working on a query already. So, start an
- // autocomplete query for the current text. This also sets
- // user_input_in_progress_ to true, which we want: if the user has started
- // to interact with the popup, changing the permanent_text_ shouldn't
- // change the displayed text.
- // Note: This does not force the popup to open immediately.
- // TODO(pkasting): We should, in fact, force this particular query to open
- // the popup immediately.
- if (!user_input_in_progress_)
- InternalSetUserText(permanent_text_);
- view_->UpdatePopup();
- } else {
- // TODO(pkasting): The popup is working on a query but is not open. We
- // should force it to open immediately.
- }
- } else {
+ if (popup_model()->IsOpen()) {
#if defined(HTML_INSTANT_EXTENDED_POPUP)
InstantController* instant = GetInstantController();
if (instant && instant->OnUpOrDownKeyPressed(count)) {
@@ -922,14 +905,33 @@
// irrelevant, so don't process the key press ourselves. However, do stop
// the autocomplete system from changing the results.
autocomplete_controller()->Stop(false);
- } else
+ return;
+ }
#endif
- {
- // The popup is open, so the user should be able to interact with it
- // normally.
- popup_model()->Move(count);
- }
+
+ // The popup is open, so the user should be able to interact with it
+ // normally.
+ popup_model()->Move(count);
+ return;
}
+
+ if (!query_in_progress()) {
+ // The popup is neither open nor working on a query already. So, start an
+ // autocomplete query for the current text. This also sets
+ // user_input_in_progress_ to true, which we want: if the user has started
+ // to interact with the popup, changing the permanent_text_ shouldn't change
+ // the displayed text.
+ // Note: This does not force the popup to open immediately.
+ // TODO(pkasting): We should, in fact, force this particular query to open
+ // the popup immediately.
+ if (!user_input_in_progress_)
+ InternalSetUserText(permanent_text_);
+ view_->UpdatePopup();
+ return;
+ }
+
+ // TODO(pkasting): The popup is working on a query but is not open. We should
+ // force it to open immediately.
}
void OmniboxEditModel::OnPopupDataChanged(
@@ -1235,11 +1237,11 @@
TemplateURLServiceFactory::GetForProfile(profile_)->
GetDefaultSearchProvider();
if (default_provider && default_provider->SupportsReplacement()) {
- *match = SearchProvider::CreateSearchSuggestion(profile_,
- autocomplete_controller()->search_provider(), input, text, text,
- 0, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, false,
- default_provider->keyword(),
+ *match = SearchProvider::CreateSearchSuggestion(
+ autocomplete_controller()->search_provider(), 0,
+ AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, default_provider,
+ text, text, input, false,
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
controller_->GetOmniboxBounds().x());
} else {
// Can't create a new search match. Leave |match| as is, with an
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_controller.cc ('k') | chrome/browser/ui/startup/startup_browser_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698