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

Unified Diff: chrome/browser/search/instant_service.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/browser/search/instant_io_context.cc ('k') | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/instant_service.h
diff --git a/chrome/browser/search/instant_service.h b/chrome/browser/search/instant_service.h
index d1c84cae31ecfe7f8ad2f2d8d65f7575d9e6f40c..14738fcae98b47df4870a5aa21875c5f21523254 100644
--- a/chrome/browser/search/instant_service.h
+++ b/chrome/browser/search/instant_service.h
@@ -13,6 +13,7 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "chrome/common/instant_restricted_id_cache.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -55,18 +56,22 @@ class InstantService : public ProfileKeyedService,
}
#endif
- // If |url| is known the existing Most Visited item ID is returned. Otherwise
- // a new Most Visited item ID is associated with the |url| and returned.
- uint64 AddURL(const GURL& url);
+ // Most visited item API.
- // If there is a mapping for the |url|, sets |most_visited_item_id| and
- // returns true.
- bool GetMostVisitedItemIDForURL(const GURL& url,
- uint64* most_visited_item_id);
+ // Adds |items| to the |most_visited_item_cache_| assigning restricted IDs in
+ // the process.
+ void AddMostVisitedItems(const std::vector<InstantMostVisitedItem>& items);
- // If there is a mapping for the |most_visited_item_id|, sets |url| and
- // returns true.
- bool GetURLForMostVisitedItemId(uint64 most_visited_item_id, GURL* url);
+ // Returns the last added InstantMostVisitedItems. After the call to
+ // |AddMostVisitedItems|, the caller should call this to get the items with
+ // the assigned IDs.
+ void GetCurrentMostVisitedItems(
+ std::vector<InstantMostVisitedItemIDPair>* items) const;
+
+ // If the |most_visited_item_id| is found in the cache, sets the |item| to it
+ // and returns true.
+ bool GetMostVisitedItemForID(InstantRestrictedID most_visited_item_id,
+ InstantMostVisitedItem* item) const;
private:
// Overridden from ProfileKeyedService:
@@ -77,22 +82,13 @@ class InstantService : public ProfileKeyedService,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // Removes entries of each url in |deleted_urls| from the ID maps. Or all
- // IDs if |all_history| is true. |deleted_ids| is filled with the newly
- // deleted Most Visited item IDs.
- void DeleteHistoryURLs(const std::vector<GURL>& deleted_urls,
- std::vector<uint64>* deleted_ids);
-
Profile* const profile_;
// The process ids associated with Instant processes.
std::set<int> process_ids_;
- // A mapping of Most Visited IDs to URLs. Used to hide Most Visited and
- // Favicon URLs from the Instant search provider.
- uint64 last_most_visited_item_id_;
- std::map<uint64, GURL> most_visited_item_id_to_url_map_;
- std::map<GURL, uint64> url_to_most_visited_item_id_map_;
+ // A cache of the InstantMostVisitedItems sent to the Instant Pages.
+ InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_item_cache_;
content::NotificationRegistrar registrar_;
« no previous file with comments | « chrome/browser/search/instant_io_context.cc ('k') | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698