Index: chrome/browser/history/top_sites_database.h |
diff --git a/chrome/browser/history/top_sites_database.h b/chrome/browser/history/top_sites_database.h |
index 9659d2a937f97d42fcd823023a0b899d43c1efc6..baca2499c8108a28773f0de765e65ce287ba9e25 100644 |
--- a/chrome/browser/history/top_sites_database.h |
+++ b/chrome/browser/history/top_sites_database.h |
@@ -7,6 +7,7 @@ |
#include <map> |
#include <string> |
+#include <vector> |
#include "base/gtest_prod_util.h" |
#include "chrome/browser/history/history_types.h" |
@@ -64,6 +65,12 @@ class TopSitesDatabase { |
FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, Recovery2); |
FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, Recovery3); |
FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, AddRemoveEditThumbnails); |
+ FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, EncodeCSVString); |
+ FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, DecodeCSVStringSucceed); |
+ FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, DecodeCSVStringFail); |
+ FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, EncodeRedirects); |
+ FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, DecodeRedirects); |
+ FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, DecodeRedirectsFallback); |
// Rank of all URLs that are forced and therefore cannot be automatically |
// evicted. |
@@ -81,6 +88,22 @@ class TopSitesDatabase { |
int new_rank, |
const Images& thumbnail); |
+ // Encodes a vector of strings as a single string, as a comma separated list |
beaudoin
2014/09/09 21:32:27
as a single string --> inside a single string
huangs
2014/09/11 01:58:13
Done.
|
+ // of quoted strings. Existing quotation marks are escaped as "\"\"". |
beaudoin
2014/09/09 21:32:27
You mean existing quotation marks are escaped by p
huangs
2014/09/11 01:58:13
Backslash is not involved; we substituted '"' to '
|
+ static std::string EncodeCSVString(const std::vector<std::string> str_list); |
+ |
+ // Decodes a string encoded by EncodeCSVString() as a vector of strings, |
+ // On success returns true, otherwise returns false and ignores |str_list|. |
+ static bool DecodeCSVString(const std::string csv, |
+ std::vector<std::string>* str_list); |
+ |
+ // Encodes redirects in |url| as string. |
beaudoin
2014/09/09 21:32:27
|url|?
huangs
2014/09/11 01:58:14
Done.
|
+ static std::string EncodeRedirects(const RedirectList& redirects); |
+ |
+ // Decodes a redirects string, appends the result ot |redirects|. |
beaudoin
2014/09/09 21:32:27
ot -> to
huangs
2014/09/11 01:58:14
Done.
|
+ static void DecodeRedirects(const std::string& encoded_redirects, |
+ RedirectList* redirects); |
+ |
// Sets the page rank. Should be called within an open transaction. |
void UpdatePageRankNoTransaction(const MostVisitedURL& url, int new_rank); |