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

Unified Diff: chrome/browser/spellchecker/spellcheck_custom_dictionary.h

Issue 11414282: Improve reliability of custom spelling dictionary file. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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/spellchecker/spellcheck_custom_dictionary.h
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
index b1d6045f1db0231c841c7e57c7738cf5b490a0c7..f2035c9f1405e5543aafdfccc3a916491bd6d30e 100644
--- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
@@ -75,12 +75,31 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary {
void SetCustomWordListAndDelete(
chrome::spellcheck_common::WordList* custom_words);
+ // Loads the dictionary file into |contents|. If the dictionary checksum is
+ // not valid, but backup checksum is valid, then restores the backup and loads
+ // that into |contents| instead.
+ void LoadDictionaryContentsReliably(std::string* contents);
+
+ // Backs up the original dictionary and checksum files, saves |contents| into
+ // the dictionary file, and saves the checksum of |contents| into the checksum
+ // file.
+ void SaveDictionryContentsReliably(const std::string& contents);
+
// In-memory cache of the custom words file.
chrome::spellcheck_common::WordList words_;
// A path for custom dictionary per profile.
FilePath custom_dictionary_path_;
+ // A path for checksum of custom dictionary per profile.
+ FilePath custom_dictionary_checksum_path_;
+
groby-ooo-7-16 2012/12/03 17:12:44 Can't we just derive all those filepaths computati
please use gerrit instead 2012/12/03 23:16:51 Done.
+ // A path for custom dictionary backup per profile.
+ FilePath custom_dictionary_backup_path_;
+
+ // A path for checksum of custom dictionary backup per profile.
+ FilePath custom_dictionary_checksum_backup_path_;
+
base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_;
std::vector<Observer*> observers_;

Powered by Google App Engine
This is Rietveld 408576698