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

Unified Diff: chrome/browser/ui/omnibox/omnibox_controller.h

Issue 14698028: Omnibox refactor. OmniboxController now holds an AutocompleteMatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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_controller.h
diff --git a/chrome/browser/ui/omnibox/omnibox_controller.h b/chrome/browser/ui/omnibox/omnibox_controller.h
index ced878b830be3750ddfac8be2fc3e874ef190b2b..bdf0d24dd0e939b8e961e3a30f30fa17a82db7eb 100644
--- a/chrome/browser/ui/omnibox/omnibox_controller.h
+++ b/chrome/browser/ui/omnibox/omnibox_controller.h
@@ -11,11 +11,13 @@
#include "base/strings/string16.h"
#include "chrome/browser/autocomplete/autocomplete_controller.h"
#include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
+#include "chrome/browser/autocomplete/autocomplete_match.h"
struct AutocompleteMatch;
class AutocompleteResult;
class GURL;
class InstantController;
+struct InstantSuggestion;
class OmniboxEditModel;
class OmniboxPopupModel;
class Profile;
@@ -63,6 +65,17 @@ class OmniboxController : public AutocompleteControllerDelegate {
bool just_deleted_text,
bool keyword_is_selected);
+ // Calls through to SearchProvider::FinalizeInstantQuery.
+ void FinalizeInstantQuery(const string16& input_text,
+ const InstantSuggestion& suggestion);
+
+ // Sets the suggestion text.
+ void SetInstantSuggestion(const InstantSuggestion& suggestion);
+
+ // Set |current_match_| to an invalid value, indicating that we do not yet
+ // have a valid match for the current text in the omnibox.
+ void InvalidateCurrentMatch();
+
void set_popup_model(OmniboxPopupModel* popup_model) {
popup_ = popup_model;
}
@@ -71,6 +84,10 @@ class OmniboxController : public AutocompleteControllerDelegate {
// LocationBarView, making this accessor unnecessary.
OmniboxPopupModel* popup_model() const { return popup_; }
+ const AutocompleteMatch& current_match() const { return current_match_; }
+
+ const string16& gray_suggestion() const { return gray_suggestion_; }
+
// Turns off keyword mode for the current match.
void ClearPopupKeywordMode() const;
@@ -98,6 +115,11 @@ class OmniboxController : public AutocompleteControllerDelegate {
// which OmniboxEditModel has some ways of reaching.
InstantController* GetInstantController() const;
+ // Creates an AutocompleteMatch for an instant result and sets it into
+ // |current_match_|.
+ void CreateAndSetInstantMatch(string16 query_string,
+ string16 input_text,
+ AutocompleteMatchType::Type match_type);
// Weak, it owns us.
// TODO(beaudoin): Consider defining a delegate to ease unit testing.
OmniboxEditModel* omnibox_edit_model_;
@@ -106,8 +128,20 @@ class OmniboxController : public AutocompleteControllerDelegate {
OmniboxPopupModel* popup_;
+ InstantController* instant_controller_;
+
scoped_ptr<AutocompleteController> autocomplete_controller_;
+ // TODO(beaudoin): This AutocompleteMatch is used to let the OmniboxEditModel
+ // know what it should display. Not every field is required for that purpose,
+ // but the ones specifically needed are unclear. We should therefore spend
+ // some time to extract these fields and use a tighter structure here.
+ AutocompleteMatch current_match_;
+
+ // The completion suggested by instant, displayed in gray text besides
+ // |fill_into_edit|.
+ string16 gray_suggestion_;
+
DISALLOW_COPY_AND_ASSIGN(OmniboxController);
};

Powered by Google App Engine
This is Rietveld 408576698