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 14 matching lines...) Expand all Loading... | |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 explicit SpellcheckCustomDictionary(Profile* profile); | 27 explicit SpellcheckCustomDictionary(Profile* profile); |
| 28 virtual ~SpellcheckCustomDictionary(); | 28 virtual ~SpellcheckCustomDictionary(); |
| 29 | 29 |
| 30 // Overridden from SpellcheckDictionary: | 30 // Overridden from SpellcheckDictionary: |
| 31 virtual void Load() OVERRIDE; | 31 virtual void Load() OVERRIDE; |
| 32 | 32 |
| 33 const chrome::spellcheck_common::WordList& GetWords() const; | 33 const chrome::spellcheck_common::WordList& GetWords() const; |
| 34 | 34 |
| 35 // Populates the given vector with the list of words in the custom dictionary | |
|
groby-ooo-7-16
2012/11/29 23:35:47
Populates |custom_words|...
please use gerrit instead
2012/11/29 23:48:03
Done.
| |
| 36 // file. Makes sure that the custom dictionary file is sorted and does not | |
| 37 // have duplicates. | |
| 35 void LoadDictionaryIntoCustomWordList( | 38 void LoadDictionaryIntoCustomWordList( |
| 36 chrome::spellcheck_common::WordList* custom_words); | 39 chrome::spellcheck_common::WordList* custom_words); |
| 37 | 40 |
| 38 // Moves the words from the |custom_words| argument into its own private | 41 // Moves the words from the |custom_words| argument into its own private |
| 39 // member variable. Does not delete the memory at |custom_words|. | 42 // member variable. Does not delete the memory at |custom_words|. |
| 40 void SetCustomWordList(chrome::spellcheck_common::WordList* custom_words); | 43 void SetCustomWordList(chrome::spellcheck_common::WordList* custom_words); |
| 41 | 44 |
| 42 // Adds the given word to the custom words list and inform renderer of the | 45 // Adds the given word to the custom words list and inform renderer of the |
| 43 // update. Returns false for duplicate words. | 46 // update. Returns false for duplicate words. |
| 44 bool AddWord(const std::string& word); | 47 bool AddWord(const std::string& word); |
| 45 | 48 |
| 46 // Returns false for duplicate words. | 49 // Returns false for duplicate words. |
| 47 bool CustomWordAddedLocally(const std::string& word); | 50 bool CustomWordAddedLocally(const std::string& word); |
| 48 | 51 |
| 49 void WriteWordToCustomDictionary(const std::string& word); | 52 void WriteWordToCustomDictionary(const std::string& word); |
| 50 | 53 |
| 51 // Removes the given word from the custom words list and inform renderer of | 54 // Removes the given word from the custom words list and informs renderer of |
| 52 // the update. Returns false for words that are not in the dictionary. | 55 // the update. Returns false for words that are not in the dictionary. |
| 53 bool RemoveWord(const std::string& word); | 56 bool RemoveWord(const std::string& word); |
| 54 | 57 |
| 55 // Returns false for words that are not in the dictionary. | 58 // Returns false for words that are not in the dictionary. |
| 56 bool CustomWordRemovedLocally(const std::string& word); | 59 bool CustomWordRemovedLocally(const std::string& word); |
| 57 | 60 |
| 58 void EraseWordFromCustomDictionary(const std::string& word); | 61 void EraseWordFromCustomDictionary(const std::string& word); |
| 59 | 62 |
| 60 void AddObserver(Observer* observer); | 63 void AddObserver(Observer* observer); |
| 61 void RemoveObserver(Observer* observer); | 64 void RemoveObserver(Observer* observer); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 79 FilePath custom_dictionary_path_; | 82 FilePath custom_dictionary_path_; |
| 80 | 83 |
| 81 base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; | 84 base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; |
| 82 | 85 |
| 83 std::vector<Observer*> observers_; | 86 std::vector<Observer*> observers_; |
| 84 | 87 |
| 85 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); | 88 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ | 91 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ |
| OLD | NEW |