Chromium Code Reviews| 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..078b6c6a91e2ad4b59f0840d88a580859cc9ffc6 100644 |
| --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h |
| +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h |
| @@ -11,6 +11,7 @@ |
| #include "base/file_path.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/observer_list.h" |
| #include "chrome/browser/spellchecker/spellcheck_dictionary.h" |
| #include "chrome/common/spellcheck_common.h" |
| @@ -75,6 +76,22 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary { |
| void SetCustomWordListAndDelete( |
| chrome::spellcheck_common::WordList* custom_words); |
| + // Loads the dictionary file into |custom_words|. If the dictionary checksum |
| + // is not valid, but backup checksum is valid, then restores the backup and |
| + // loads that into |custom_words| instead. |
|
groby-ooo-7-16
2012/12/05 00:56:19
"If the backup is invalid too, |custom_words| will
please use gerrit instead
2012/12/05 16:51:26
Done.
|
| + void LoadDictionaryFileReliably( |
| + chrome::spellcheck_common::WordList* custom_words); |
| + |
| + // Backs up the original dictionary and checksum files, saves |custom_words| |
|
groby-ooo-7-16
2012/12/05 00:56:19
- "and checksum files"
please use gerrit instead
2012/12/05 16:51:26
Done.
|
| + // and its checksum into the dictionary file. |
| + void SaveDictionaryFileReliably( |
| + const chrome::spellcheck_common::WordList& custom_words); |
| + |
| + // Extracts the checksum out of |contents| and truncates |contents| to exclude |
| + // the checksum line. Returns an empty string if |contents| do not contain a |
| + // checksum. |
| + std::string GetChecksum(std::string* contents); |
| + |
| // In-memory cache of the custom words file. |
| chrome::spellcheck_common::WordList words_; |
| @@ -83,7 +100,10 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary { |
| base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; |
| - std::vector<Observer*> observers_; |
| + ObserverList<Observer> observers_; |
| + |
| + const FilePath::StringType backup_extension_; |
| + const std::string checksum_prefix_; |
|
groby-ooo-7-16
2012/12/05 00:56:19
Why a member? It never changes its value, and it's
please use gerrit instead
2012/12/05 16:51:26
Done.
|
| DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); |
| }; |