| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/scoped_vector.h" | |
| 17 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 18 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 19 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" | 18 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" |
| 20 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" | 19 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" |
| 21 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
| 22 #include "components/prefs/pref_change_registrar.h" | 21 #include "components/prefs/pref_change_registrar.h" |
| 23 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 24 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 25 | 24 |
| 26 class SpellCheckHostMetrics; | 25 class SpellCheckHostMetrics; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // or null when metrics recording is disabled. | 105 // or null when metrics recording is disabled. |
| 107 SpellCheckHostMetrics* GetMetrics() const; | 106 SpellCheckHostMetrics* GetMetrics() const; |
| 108 | 107 |
| 109 // Returns the instance of the custom dictionary. | 108 // Returns the instance of the custom dictionary. |
| 110 SpellcheckCustomDictionary* GetCustomDictionary(); | 109 SpellcheckCustomDictionary* GetCustomDictionary(); |
| 111 | 110 |
| 112 // Starts the process of loading the Hunspell dictionaries. | 111 // Starts the process of loading the Hunspell dictionaries. |
| 113 void LoadHunspellDictionaries(); | 112 void LoadHunspellDictionaries(); |
| 114 | 113 |
| 115 // Returns the instance of the vector of Hunspell dictionaries. | 114 // Returns the instance of the vector of Hunspell dictionaries. |
| 116 const ScopedVector<SpellcheckHunspellDictionary>& GetHunspellDictionaries(); | 115 const std::vector<std::unique_ptr<SpellcheckHunspellDictionary>>& |
| 116 GetHunspellDictionaries(); |
| 117 | 117 |
| 118 // Returns the instance of the spelling service feedback sender. | 118 // Returns the instance of the spelling service feedback sender. |
| 119 spellcheck::FeedbackSender* GetFeedbackSender(); | 119 spellcheck::FeedbackSender* GetFeedbackSender(); |
| 120 | 120 |
| 121 // Load a dictionary from a given path. Format specifies how the dictionary | 121 // Load a dictionary from a given path. Format specifies how the dictionary |
| 122 // is stored. Return value is true if successful. | 122 // is stored. Return value is true if successful. |
| 123 bool LoadExternalDictionary(std::string language, | 123 bool LoadExternalDictionary(std::string language, |
| 124 std::string locale, | 124 std::string locale, |
| 125 std::string path, | 125 std::string path, |
| 126 DictionaryFormat format); | 126 DictionaryFormat format); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 PrefChangeRegistrar pref_change_registrar_; | 178 PrefChangeRegistrar pref_change_registrar_; |
| 179 content::NotificationRegistrar registrar_; | 179 content::NotificationRegistrar registrar_; |
| 180 | 180 |
| 181 // A pointer to the BrowserContext which this service refers to. | 181 // A pointer to the BrowserContext which this service refers to. |
| 182 content::BrowserContext* context_; | 182 content::BrowserContext* context_; |
| 183 | 183 |
| 184 std::unique_ptr<SpellCheckHostMetrics> metrics_; | 184 std::unique_ptr<SpellCheckHostMetrics> metrics_; |
| 185 | 185 |
| 186 std::unique_ptr<SpellcheckCustomDictionary> custom_dictionary_; | 186 std::unique_ptr<SpellcheckCustomDictionary> custom_dictionary_; |
| 187 | 187 |
| 188 ScopedVector<SpellcheckHunspellDictionary> hunspell_dictionaries_; | 188 std::vector<std::unique_ptr<SpellcheckHunspellDictionary>> |
| 189 hunspell_dictionaries_; |
| 189 | 190 |
| 190 std::unique_ptr<spellcheck::FeedbackSender> feedback_sender_; | 191 std::unique_ptr<spellcheck::FeedbackSender> feedback_sender_; |
| 191 | 192 |
| 192 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; | 193 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; |
| 193 | 194 |
| 194 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); | 195 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); |
| 195 }; | 196 }; |
| 196 | 197 |
| 197 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 198 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
| OLD | NEW |