| 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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Dictionary format used for loading an external dictionary. | 48 // Dictionary format used for loading an external dictionary. |
| 49 enum DictionaryFormat { | 49 enum DictionaryFormat { |
| 50 DICT_HUNSPELL, | 50 DICT_HUNSPELL, |
| 51 DICT_TEXT, | 51 DICT_TEXT, |
| 52 DICT_UNKNOWN, | 52 DICT_UNKNOWN, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 explicit SpellcheckService(content::BrowserContext* context); | 55 explicit SpellcheckService(content::BrowserContext* context); |
| 56 virtual ~SpellcheckService(); | 56 ~SpellcheckService() override; |
| 57 | 57 |
| 58 // This function computes a vector of strings which are to be displayed in | 58 // This function computes a vector of strings which are to be displayed in |
| 59 // the context menu over a text area for changing spell check languages. It | 59 // the context menu over a text area for changing spell check languages. It |
| 60 // returns the index of the current spell check language in the vector. | 60 // returns the index of the current spell check language in the vector. |
| 61 // TODO(port): this should take a vector of base::string16, but the | 61 // TODO(port): this should take a vector of base::string16, but the |
| 62 // implementation has some dependencies in l10n util that need porting first. | 62 // implementation has some dependencies in l10n util that need porting first. |
| 63 static int GetSpellCheckLanguages(content::BrowserContext* context, | 63 static int GetSpellCheckLanguages(content::BrowserContext* context, |
| 64 std::vector<std::string>* languages); | 64 std::vector<std::string>* languages); |
| 65 | 65 |
| 66 // Computes a vector of strings which are to be displayed in the context | 66 // Computes a vector of strings which are to be displayed in the context |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 bool LoadExternalDictionary(std::string language, | 102 bool LoadExternalDictionary(std::string language, |
| 103 std::string locale, | 103 std::string locale, |
| 104 std::string path, | 104 std::string path, |
| 105 DictionaryFormat format); | 105 DictionaryFormat format); |
| 106 | 106 |
| 107 // Unload a dictionary. The path is given to identify the dictionary. | 107 // Unload a dictionary. The path is given to identify the dictionary. |
| 108 // Return value is true if successful. | 108 // Return value is true if successful. |
| 109 bool UnloadExternalDictionary(std::string path); | 109 bool UnloadExternalDictionary(std::string path); |
| 110 | 110 |
| 111 // NotificationProfile implementation. | 111 // NotificationProfile implementation. |
| 112 virtual void Observe(int type, | 112 void Observe(int type, |
| 113 const content::NotificationSource& source, | 113 const content::NotificationSource& source, |
| 114 const content::NotificationDetails& details) override; | 114 const content::NotificationDetails& details) override; |
| 115 | 115 |
| 116 // SpellcheckCustomDictionary::Observer implementation. | 116 // SpellcheckCustomDictionary::Observer implementation. |
| 117 virtual void OnCustomDictionaryLoaded() override; | 117 void OnCustomDictionaryLoaded() override; |
| 118 virtual void OnCustomDictionaryChanged( | 118 void OnCustomDictionaryChanged( |
| 119 const SpellcheckCustomDictionary::Change& dictionary_change) override; | 119 const SpellcheckCustomDictionary::Change& dictionary_change) override; |
| 120 | 120 |
| 121 // SpellcheckHunspellDictionary::Observer implementation. | 121 // SpellcheckHunspellDictionary::Observer implementation. |
| 122 virtual void OnHunspellDictionaryInitialized() override; | 122 void OnHunspellDictionaryInitialized() override; |
| 123 virtual void OnHunspellDictionaryDownloadBegin() override; | 123 void OnHunspellDictionaryDownloadBegin() override; |
| 124 virtual void OnHunspellDictionaryDownloadSuccess() override; | 124 void OnHunspellDictionaryDownloadSuccess() override; |
| 125 virtual void OnHunspellDictionaryDownloadFailure() override; | 125 void OnHunspellDictionaryDownloadFailure() override; |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 FRIEND_TEST_ALL_PREFIXES(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT); | 128 FRIEND_TEST_ALL_PREFIXES(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT); |
| 129 | 129 |
| 130 // Attaches an event so browser tests can listen the status events. | 130 // Attaches an event so browser tests can listen the status events. |
| 131 static void AttachStatusEvent(base::WaitableEvent* status_event); | 131 static void AttachStatusEvent(base::WaitableEvent* status_event); |
| 132 | 132 |
| 133 // Returns the status event type. | 133 // Returns the status event type. |
| 134 static EventType GetStatusEvent(); | 134 static EventType GetStatusEvent(); |
| 135 | 135 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 164 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; | 164 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; |
| 165 | 165 |
| 166 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; | 166 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; |
| 167 | 167 |
| 168 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; | 168 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; |
| 169 | 169 |
| 170 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); | 170 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 173 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
| OLD | NEW |