| Index: chrome/browser/history/url_index_private_data.h
|
| ===================================================================
|
| --- chrome/browser/history/url_index_private_data.h (revision 125078)
|
| +++ chrome/browser/history/url_index_private_data.h (working copy)
|
| @@ -8,8 +8,10 @@
|
|
|
| #include "base/file_path.h"
|
| #include "base/gtest_prod_util.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "chrome/browser/history/in_memory_url_index_types.h"
|
| #include "chrome/browser/history/in_memory_url_index_cache.pb.h"
|
| +#include "content/public/browser/notification_details.h"
|
|
|
| class HistoryQuickProviderTest;
|
|
|
| @@ -22,6 +24,7 @@
|
| namespace imui = in_memory_url_index;
|
|
|
| class HistoryDatabase;
|
| +class InMemoryURLIndex;
|
|
|
| // A structure describing the InMemoryURLIndex's internal data and providing for
|
| // restoring, rebuilding and updating that internal data.
|
| @@ -131,23 +134,39 @@
|
| // down into words and each word is broken down into characters.
|
| void set_languages(const std::string& languages) { languages_ = languages; }
|
|
|
| - // Restores the index's private data from the cache file stored in the
|
| - // profile directory and returns true if successful.
|
| - bool RestoreFromFile(const FilePath& file_path);
|
| + // Creates a new URLIndexPrivateData object, populates it from the contents
|
| + // of the cache file stored in |file_path|, and assigns it to |data|.
|
| + static void RestoreFromFileTask(const FilePath& file_path,
|
| + URLIndexPrivateData* data);
|
|
|
| + // Constructs a new object by restoring its contents from the file at |path|.
|
| + // Returns the new URLIndexPrivateData which on success will contain the
|
| + // restored data but upon failure will be empty.
|
| + static URLIndexPrivateData* RestoreFromFile(const FilePath& path);
|
| +
|
| // Constructs a new object by rebuilding its contents from the history
|
| // database in |history_db|. Returns the new URLIndexPrivateData which on
|
| // success will contain the rebuilt data but upon failure will be empty.
|
| static URLIndexPrivateData* RebuildFromHistory(HistoryDatabase* history_db);
|
|
|
| + // Writes |private_data| as a cache file to |file_path| and returns success
|
| + // via |succeeded|.
|
| + static void WritePrivateDataToCacheFileTask(
|
| + scoped_ptr<URLIndexPrivateData> private_data,
|
| + const FilePath& file_path,
|
| + scoped_refptr<history::RefCountedBool> succeeded);
|
| +
|
| // Caches the index private data and writes the cache file to the profile
|
| - // directory.
|
| + // directory. Called by WritePrivateDataToCacheFileTask.
|
| bool SaveToFile(const FilePath& file_path);
|
|
|
| // Initializes all index data members in preparation for restoring the index
|
| // from the cache or a complete rebuild from the history database.
|
| void Clear();
|
|
|
| + // Returns true if there is no data in the index.
|
| + bool Empty() const;
|
| +
|
| // Adds |word_id| to |history_id|'s entry in the history/word map,
|
| // creating a new entry if one does not already exist.
|
| void AddToHistoryIDWordMap(HistoryID history_id, WordID word_id);
|
| @@ -230,9 +249,6 @@
|
| static int ScoreComponentForMatches(const TermMatches& matches,
|
| size_t max_length);
|
|
|
| - // Determines if |gurl| has a whitelisted scheme and returns true if so.
|
| - bool URLSchemeIsWhitelisted(const GURL& gurl) const;
|
| -
|
| // Encode a data structure into the protobuf |cache|.
|
| void SavePrivateData(imui::InMemoryURLIndexCacheItem* cache) const;
|
| void SaveWordList(imui::InMemoryURLIndexCacheItem* cache) const;
|
| @@ -250,6 +266,9 @@
|
| bool RestoreWordIDHistoryMap(const imui::InMemoryURLIndexCacheItem& cache);
|
| bool RestoreHistoryInfoMap(const imui::InMemoryURLIndexCacheItem& cache);
|
|
|
| + // Determines if |gurl| has a whitelisted scheme and returns true if so.
|
| + bool URLSchemeIsWhitelisted(const GURL& gurl) const;
|
| +
|
| // Cache of search terms.
|
| SearchTermCacheMap search_term_cache_;
|
|
|
|
|