| Index: chrome/renderer/searchbox/searchbox.cc
|
| diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc
|
| index 59163ee0739287a2d7528451536f5c4592cf0d3d..03ca37dad7d0198c058822f0cb30c80735dbee35 100644
|
| --- a/chrome/renderer/searchbox/searchbox.cc
|
| +++ b/chrome/renderer/searchbox/searchbox.cc
|
| @@ -12,16 +12,6 @@
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
|
|
| -namespace {
|
| -
|
| -// Prefix for a thumbnail URL.
|
| -const char kThumbnailUrlPrefix[] = "chrome-search://thumb/";
|
| -
|
| -// Prefix for a thumbnail URL.
|
| -const char kFaviconUrlPrefix[] = "chrome-search://favicon/";
|
| -
|
| -}
|
| -
|
| SearchBox::SearchBox(content::RenderView* render_view)
|
| : content::RenderViewObserver(render_view),
|
| content::RenderViewObserverTracker<SearchBox>(render_view),
|
| @@ -33,8 +23,7 @@ SearchBox::SearchBox(content::RenderView* render_view)
|
| last_results_base_(0),
|
| is_key_capture_enabled_(false),
|
| display_instant_results_(false),
|
| - omnibox_font_size_(0),
|
| - last_restricted_id_(0) {
|
| + omnibox_font_size_(0) {
|
| }
|
|
|
| SearchBox::~SearchBox() {
|
| @@ -84,20 +73,19 @@ void SearchBox::NavigateToURL(const GURL& url,
|
| url, transition, disposition));
|
| }
|
|
|
| -void SearchBox::DeleteMostVisitedItem(int restrict_id) {
|
| - string16 url = RestrictedIdToURL(restrict_id);
|
| - render_view()->Send(new ChromeViewHostMsg_InstantDeleteMostVisitedItem(
|
| - render_view()->GetRoutingID(), GURL(url)));
|
| +void SearchBox::DeleteMostVisitedItem(uint64 restricted_id) {
|
| + render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem(
|
| + render_view()->GetRoutingID(), restricted_id));
|
| }
|
|
|
| -void SearchBox::UndoMostVisitedDeletion(int restrict_id) {
|
| - string16 url = RestrictedIdToURL(restrict_id);
|
| - render_view()->Send(new ChromeViewHostMsg_InstantUndoMostVisitedDeletion(
|
| - render_view()->GetRoutingID(), GURL(url)));
|
| +void SearchBox::UndoMostVisitedDeletion(uint64 restricted_id) {
|
| + render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion(
|
| + render_view()->GetRoutingID(), restricted_id));
|
| }
|
|
|
| void SearchBox::UndoAllMostVisitedDeletions() {
|
| - render_view()->Send(new ChromeViewHostMsg_InstantUndoAllMostVisitedDeletions(
|
| + render_view()->Send(
|
| + new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions(
|
| render_view()->GetRoutingID()));
|
| }
|
|
|
| @@ -124,7 +112,7 @@ const std::vector<InstantAutocompleteResult>&
|
| }
|
|
|
| const InstantAutocompleteResult* SearchBox::GetAutocompleteResultWithId(
|
| - size_t restricted_id) const {
|
| + uint64 restricted_id) const {
|
| if (restricted_id < last_results_base_ ||
|
| restricted_id >= last_results_base_ + last_autocomplete_results_.size())
|
| return NULL;
|
| @@ -162,7 +150,7 @@ bool SearchBox::OnMessageReceived(const IPC::Message& message) {
|
| IPC_MESSAGE_HANDLER(
|
| ChromeViewMsg_SearchBoxGrantChromeSearchAccessFromOrigin,
|
| OnGrantChromeSearchAccessFromOrigin)
|
| - IPC_MESSAGE_HANDLER(ChromeViewMsg_InstantMostVisitedItemsChanged,
|
| + IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged,
|
| OnMostVisitedChanged)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
| @@ -350,7 +338,7 @@ void SearchBox::Reset() {
|
| }
|
|
|
| void SearchBox::OnMostVisitedChanged(
|
| - const std::vector<MostVisitedItem>& items) {
|
| + const std::vector<InstantMostVisitedItem>& items) {
|
| most_visited_items_ = items;
|
|
|
| if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
|
| @@ -359,35 +347,7 @@ void SearchBox::OnMostVisitedChanged(
|
| }
|
| }
|
|
|
| -const std::vector<MostVisitedItem>& SearchBox::GetMostVisitedItems() {
|
| +const std::vector<InstantMostVisitedItem>&
|
| +SearchBox::GetMostVisitedItems() const {
|
| return most_visited_items_;
|
| }
|
| -
|
| -int SearchBox::UrlToRestrictedId(string16 url) {
|
| - if (url_to_restricted_id_map_[url])
|
| - return url_to_restricted_id_map_[url];
|
| -
|
| - last_restricted_id_++;
|
| - url_to_restricted_id_map_[url] = last_restricted_id_;
|
| - restricted_id_to_url_map_[last_restricted_id_] = url;
|
| -
|
| - return last_restricted_id_;
|
| -}
|
| -
|
| -string16 SearchBox::RestrictedIdToURL(int id) {
|
| - return restricted_id_to_url_map_[id];
|
| -}
|
| -
|
| -string16 SearchBox::GenerateThumbnailUrl(int id) {
|
| - std::ostringstream ostr;
|
| - ostr << kThumbnailUrlPrefix << id;
|
| - GURL url = GURL(ostr.str());
|
| - return UTF8ToUTF16(url.spec());
|
| -}
|
| -
|
| -string16 SearchBox::GenerateFaviconUrl(int id) {
|
| - std::ostringstream ostr;
|
| - ostr << kFaviconUrlPrefix << id;
|
| - GURL url = GURL(ostr.str());
|
| - return UTF8ToUTF16(url.spec());
|
| -}
|
|
|