| Index: chrome/renderer/searchbox/searchbox.h
|
| diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h
|
| index 188272968fb55f1bfa87625474479ac5c5cce858..9c9032da223c6223ee51db32d55acc978a204b47 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"
|
| @@ -49,21 +50,10 @@ 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();
|
| -
|
| const string16& query() const { return query_; }
|
| 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_; }
|
| @@ -76,14 +66,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;
|
| +
|
| + // Returns true if |restrict_id| is present in the cache and sets results to
|
| + // a copy of the result.
|
| + bool GetAutocompleteResultWithId(InstantRestrictedID restricted_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;
|
| +
|
| + // Returns true if the |restricted_id| is found in the
|
| + // |most_visited_items_cache_| and it is copied into |item|.
|
| + bool GetMostVisitedItemWithID(InstantRestrictedID restricted_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:
|
| @@ -110,7 +125,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;
|
| @@ -122,18 +138,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);
|
| };
|
|
|