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

Unified Diff: chrome/browser/instant/instant_service.h

Issue 12498002: InstantExtended: Adding InstantRestrictedIDCache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merging David's and Sreeram's changes. 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
Index: chrome/browser/instant/instant_service.h
diff --git a/chrome/browser/instant/instant_service.h b/chrome/browser/instant/instant_service.h
index bdb8a350ea9b93c02ba3e246b98d7cb8835ad0bc..e19628f3fcdd5bf07dc9fcb72df468092d9d137a 100644
--- a/chrome/browser/instant/instant_service.h
+++ b/chrome/browser/instant/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,20 @@ 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.
dhollowa 2013/03/14 00:02:43 Mention that this is the way to get the newly assi
Shishir 2013/03/14 19:53:03 Done.
+ void GetCurrentMostVisitedItems(
+ std::vector<InstantMostVisitedItemIDPair>* items);
dhollowa 2013/03/14 00:02:43 const method.
Shishir 2013/03/14 19:53:03 Done.
+
+ // Returns true is an InstantMostVisitedItem is found with |restricted_id| and
dhollowa 2013/03/14 00:02:43 Please keep the "If ..., sets... and returns true.
Shishir 2013/03/14 19:53:03 Done.
+ // copy's its data to |item|.
+ bool GetMostVisitedItemForID(InstantRestrictedID restricted_id,
+ InstantMostVisitedItem* item) const;
private:
// Overridden from ProfileKeyedService:
@@ -77,22 +80,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.
dhollowa 2013/03/14 00:02:43 Please retain the original comments, there is impo
Shishir 2013/03/14 19:53:03 Done.
+ InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_item_cache_;
content::NotificationRegistrar registrar_;

Powered by Google App Engine
This is Rietveld 408576698