Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ |
| 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // The caller owns this new list. | 68 // The caller owns this new list. |
| 69 chrome::spellcheck_common::WordList* LoadDictionary(); | 69 chrome::spellcheck_common::WordList* LoadDictionary(); |
| 70 | 70 |
| 71 // The reply point for PostTaskAndReplyWithResult. Called when LoadDictionary | 71 // The reply point for PostTaskAndReplyWithResult. Called when LoadDictionary |
| 72 // is finished reading words from custom dictionary file. Moves the strings | 72 // is finished reading words from custom dictionary file. Moves the strings |
| 73 // from the |custom_words| argument into the private member variable |words_| | 73 // from the |custom_words| argument into the private member variable |words_| |
| 74 // and deletes the memory at |custom_words|. | 74 // and deletes the memory at |custom_words|. |
| 75 void SetCustomWordListAndDelete( | 75 void SetCustomWordListAndDelete( |
| 76 chrome::spellcheck_common::WordList* custom_words); | 76 chrome::spellcheck_common::WordList* custom_words); |
| 77 | 77 |
| 78 // Loads the dictionary file into |contents|. If the dictionary checksum is | |
| 79 // not valid, but backup checksum is valid, then restores the backup and loads | |
| 80 // that into |contents| instead. | |
| 81 void LoadDictionaryContentsReliably(std::string* contents); | |
| 82 | |
| 83 // Backs up the original dictionary and checksum files, saves |contents| into | |
| 84 // the dictionary file, and saves the checksum of |contents| into the checksum | |
| 85 // file. | |
| 86 void SaveDictionryContentsReliably(const std::string& contents); | |
| 87 | |
| 78 // In-memory cache of the custom words file. | 88 // In-memory cache of the custom words file. |
| 79 chrome::spellcheck_common::WordList words_; | 89 chrome::spellcheck_common::WordList words_; |
| 80 | 90 |
| 81 // A path for custom dictionary per profile. | 91 // A path for custom dictionary per profile. |
| 82 FilePath custom_dictionary_path_; | 92 FilePath custom_dictionary_path_; |
| 83 | 93 |
| 94 // A path for checksum of custom dictionary per profile. | |
| 95 FilePath custom_dictionary_checksum_path_; | |
| 96 | |
|
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.
| |
| 97 // A path for custom dictionary backup per profile. | |
| 98 FilePath custom_dictionary_backup_path_; | |
| 99 | |
| 100 // A path for checksum of custom dictionary backup per profile. | |
| 101 FilePath custom_dictionary_checksum_backup_path_; | |
| 102 | |
| 84 base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; | 103 base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; |
| 85 | 104 |
| 86 std::vector<Observer*> observers_; | 105 std::vector<Observer*> observers_; |
| 87 | 106 |
| 88 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); | 107 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); |
| 89 }; | 108 }; |
| 90 | 109 |
| 91 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ | 110 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ |
| OLD | NEW |