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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_custom_dictionary.h

Issue 11434043: Remove duplicate words from custom spelling dictionary on load (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix unit test 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/spellchecker/spellcheck_custom_dictionary.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 |custom_words| with the list of words in the custom
36 // dictionary file. Makes sure that the custom dictionary file is sorted and
37 // does not 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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/spellchecker/spellcheck_custom_dictionary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698