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

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

Issue 12498002: InstantExtended: Adding InstantRestrictedIDCache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing android compile error. Created 7 years, 9 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
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/searchbox/searchbox.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/searchbox/searchbox.h
diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h
index 124331835a020c3bc5f5f9ba6a8d228df45f4f53..173df10ecbd3f90d736c42ee9f8ebe134bc317e2 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"
@@ -51,16 +52,6 @@ class SearchBox : public content::RenderViewObserver,
content::PageTransition transition,
WindowOpenDisposition disposition);
- // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser.
- void DeleteMostVisitedItem(uint64 most_visited_item_id);
-
- // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser.
- void UndoMostVisitedDeletion(uint64 most_visited_item_id);
-
- // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the
- // browser.
- void UndoAllMostVisitedDeletions();
-
// Shows any attached bars.
void ShowBars();
@@ -72,7 +63,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_; }
@@ -85,14 +75,39 @@ 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 autocomplete_result_id) const;
const ThemeBackgroundInfo& GetThemeBackgroundInfo();
- // Most Visited items.
- const std::vector<InstantMostVisitedItem>& GetMostVisitedItems() const;
+ // --- Autocomplete result APIs.
+
+ // Returns the most recent InstantAutocompleteResults sent by the browser.
+ void GetAutocompleteResults(
+ std::vector<InstantAutocompleteResultIDPair>* results) const;
+
+ // If the |autocomplete_result_id| is found in the cache, sets |item| to it
+ // and returns true.
+ bool GetAutocompleteResultWithID(InstantRestrictedID autocomplete_result_id,
+ InstantAutocompleteResult* result) const;
+
+ // --- Most Visited items APIs.
+
+ // Returns the latest most visited items sent by the browser.
+ void GetMostVisitedItems(
+ std::vector<InstantMostVisitedItemIDPair>* items) const;
+
+ // If the |most_visited_item_id| is found in the cache, sets |item| to it
+ // and returns true.
+ bool GetMostVisitedItemWithID(InstantRestrictedID most_visited_item_id,
+ InstantMostVisitedItem* item) const;
+
+ // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser.
+ void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id);
+
+ // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser.
+ void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id);
+
+ // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the
+ // browser.
+ void UndoAllMostVisitedDeletions();
private:
// Overridden from content::RenderViewObserver:
@@ -120,7 +135,8 @@ class SearchBox : public content::RenderViewObserver,
void OnFontInformationReceived(const string16& omnibox_font,
size_t omnibox_font_size);
void OnGrantChromeSearchAccessFromOrigin(const GURL& origin_url);
- void OnMostVisitedChanged(const std::vector<InstantMostVisitedItem>& items);
+ void OnMostVisitedChanged(
+ const std::vector<InstantMostVisitedItemIDPair>& items);
// Returns the current zoom factor of the render view or 1 on failure.
double GetZoom() const;
@@ -132,18 +148,16 @@ 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_;
bool is_key_capture_enabled_;
ThemeBackgroundInfo theme_info_;
bool display_instant_results_;
string16 omnibox_font_;
size_t omnibox_font_size_;
- std::vector<InstantMostVisitedItem> most_visited_items_;
+ InstantRestrictedIDCache<InstantAutocompleteResult>
+ autocomplete_results_cache_;
+ InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_;
DISALLOW_COPY_AND_ASSIGN(SearchBox);
};
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/searchbox/searchbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698