| 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 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Interface to implement for dictionary load and change observers. | 67 // Interface to implement for dictionary load and change observers. |
| 68 class Observer { | 68 class Observer { |
| 69 public: | 69 public: |
| 70 // Called when the custom dictionary has been loaded. | 70 // Called when the custom dictionary has been loaded. |
| 71 virtual void OnCustomDictionaryLoaded() = 0; | 71 virtual void OnCustomDictionaryLoaded() = 0; |
| 72 | 72 |
| 73 // Called when the custom dictionary has been changed. | 73 // Called when the custom dictionary has been changed. |
| 74 virtual void OnCustomDictionaryChanged(const Change& dictionary_change) = 0; | 74 virtual void OnCustomDictionaryChanged(const Change& dictionary_change) = 0; |
| 75 |
| 76 protected: |
| 77 virtual ~Observer() { } |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 explicit SpellcheckCustomDictionary(Profile* profile); | 80 explicit SpellcheckCustomDictionary(Profile* profile); |
| 78 virtual ~SpellcheckCustomDictionary(); | 81 virtual ~SpellcheckCustomDictionary(); |
| 79 | 82 |
| 80 // Returns the in-memory cache of words in the custom dictionary. | 83 // Returns the in-memory cache of words in the custom dictionary. |
| 81 const chrome::spellcheck_common::WordList& GetWords() const; | 84 const chrome::spellcheck_common::WordList& GetWords() const; |
| 82 | 85 |
| 83 // Adds |word| to the dictionary, schedules a write to disk, and notifies | 86 // Adds |word| to the dictionary, schedules a write to disk, and notifies |
| 84 // observers of the change. Returns true if |word| is valid and not a | 87 // observers of the change. Returns true if |word| is valid and not a |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Used to send sync-related errors to the sync infrastructure. | 178 // Used to send sync-related errors to the sync infrastructure. |
| 176 scoped_ptr<syncer::SyncErrorFactory> sync_error_handler_; | 179 scoped_ptr<syncer::SyncErrorFactory> sync_error_handler_; |
| 177 | 180 |
| 178 // True if the dictionary has been loaded. Otherwise false. | 181 // True if the dictionary has been loaded. Otherwise false. |
| 179 bool is_loaded_; | 182 bool is_loaded_; |
| 180 | 183 |
| 181 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); | 184 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); |
| 182 }; | 185 }; |
| 183 | 186 |
| 184 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ | 187 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ |
| OLD | NEW |