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

Unified Diff: chrome/renderer/searchbox/searchbox.h

Issue 12498002: InstantExtended: Adding InstantRestrictedIDCache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/renderer/searchbox/searchbox.h
diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h
index 445d4dcc3700d7577adaf56454a2722c9ca4f9ea..999e9af4d700018fc5dab62fb287e869f896f786 100644
--- a/chrome/renderer/searchbox/searchbox.h
+++ b/chrome/renderer/searchbox/searchbox.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/string16.h"
+#include "chrome/common/instant_restricted_id_cache.h"
#include "chrome/common/instant_types.h"
#include "chrome/common/search_types.h"
#include "content/public/common/page_transition_types.h"
@@ -59,7 +60,6 @@ class SearchBox : public content::RenderViewObserver,
bool verbatim() const { return verbatim_; }
size_t selection_start() const { return selection_start_; }
size_t selection_end() const { return selection_end_; }
- int results_base() const { return results_base_; }
bool is_key_capture_enabled() const { return is_key_capture_enabled_; }
bool display_instant_results() const { return display_instant_results_; }
const string16& omnibox_font() const { return omnibox_font_; }
@@ -72,10 +72,16 @@ class SearchBox : public content::RenderViewObserver,
// Returns the bounds of the omnibox popup in screen coordinates.
gfx::Rect GetPopupBounds() const;
- const std::vector<InstantAutocompleteResult>& GetAutocompleteResults();
- // Searchbox retains ownership of this object.
- const InstantAutocompleteResult*
- GetAutocompleteResultWithId(size_t restricted_id) const;
+ // Returns the most recent InstantAutocompleteResults sent by the browser.
+ void GetAutocompleteResults(
+ std::vector<std::pair<size_t, InstantAutocompleteResult> >*
+ results) const;
+
+ // Returns true if |restrict_id| is present in the cache and sets results to
+ // a copy of the result.
+ bool GetAutocompleteResultWithId(size_t restricted_id,
+ InstantAutocompleteResult* result) const;
+
const ThemeBackgroundInfo& GetThemeBackgroundInfo();
// Most Visited items.
@@ -123,12 +129,10 @@ class SearchBox : public content::RenderViewObserver,
bool verbatim_;
size_t selection_start_;
size_t selection_end_;
- size_t results_base_;
int start_margin_;
gfx::Rect popup_bounds_;
- std::vector<InstantAutocompleteResult> autocomplete_results_;
- size_t last_results_base_;
- std::vector<InstantAutocompleteResult> last_autocomplete_results_;
+ InstantRestrictedIdCache<InstantAutocompleteResult>
+ autocomplete_results_cache_;
bool is_key_capture_enabled_;
ThemeBackgroundInfo theme_info_;
bool display_instant_results_;

Powered by Google App Engine
This is Rietveld 408576698