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 <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "chrome/browser/spellchecker/spellcheck_dictionary.h" | 17 #include "components/spellcheck/browser/spellcheck_dictionary.h" |
18 #include "sync/api/sync_data.h" | 18 #include "sync/api/sync_data.h" |
19 #include "sync/api/sync_error.h" | 19 #include "sync/api/sync_error.h" |
20 #include "sync/api/sync_merge_result.h" | 20 #include "sync/api/sync_merge_result.h" |
21 #include "sync/api/syncable_service.h" | 21 #include "sync/api/syncable_service.h" |
22 | 22 |
23 namespace syncer { | 23 namespace syncer { |
24 class SyncErrorFactory; | 24 class SyncErrorFactory; |
25 class SyncChangeProcessor; | 25 class SyncChangeProcessor; |
26 } | 26 } |
27 | 27 |
28 namespace tracked_objects { | 28 namespace tracked_objects { |
29 class Location; | 29 class Location; |
30 } | 30 } |
31 | 31 |
32 // Defines a custom dictionary where users can add their own words. All words | 32 // Defines a custom dictionary where users can add their own words. All words |
33 // must be UTF8, between 1 and 99 bytes long, and without leading or trailing | 33 // must be UTF8, between 1 and 99 bytes long, and without leading or trailing |
34 // ASCII whitespace. The dictionary contains its own checksum when saved on | 34 // ASCII whitespace. The dictionary contains its own checksum when saved on |
35 // disk. Example dictionary file contents: | 35 // disk. Example dictionary file contents: |
36 // | 36 // |
37 // bar | 37 // bar |
38 // foo | 38 // foo |
39 // checksum_v1 = ec3df4034567e59e119fcf87f2d9bad4 | 39 // checksum_v1 = ec3df4034567e59e119fcf87f2d9bad4 |
40 // | 40 // |
41 class SpellcheckCustomDictionary : public SpellcheckDictionary, | 41 class SpellcheckCustomDictionary : public SpellcheckDictionary, |
42 public syncer::SyncableService { | 42 public syncer::SyncableService { |
43 public: | 43 public: |
| 44 static const base::FilePath::CharType kCustomDictionaryFileName[]; |
| 45 |
44 // A change to the dictionary. | 46 // A change to the dictionary. |
45 class Change { | 47 class Change { |
46 public: | 48 public: |
47 Change(); | 49 Change(); |
48 ~Change(); | 50 ~Change(); |
49 | 51 |
50 // Adds |word| in this change. | 52 // Adds |word| in this change. |
51 void AddWord(const std::string& word); | 53 void AddWord(const std::string& word); |
52 | 54 |
53 // Adds |words| in this change. | 55 // Adds |words| in this change. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // A post-startup task to fix the invalid custom dictionary file. | 219 // A post-startup task to fix the invalid custom dictionary file. |
218 base::CancelableClosure fix_invalid_file_; | 220 base::CancelableClosure fix_invalid_file_; |
219 | 221 |
220 // Used to create weak pointers for an instance of this class. | 222 // Used to create weak pointers for an instance of this class. |
221 base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; | 223 base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; |
222 | 224 |
223 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); | 225 DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary); |
224 }; | 226 }; |
225 | 227 |
226 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ | 228 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_ |
OLD | NEW |