Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 DICT_HUNSPELL, | 56 DICT_HUNSPELL, |
| 57 DICT_TEXT, | 57 DICT_TEXT, |
| 58 DICT_UNKNOWN, | 58 DICT_UNKNOWN, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 explicit SpellcheckService(content::BrowserContext* context); | 61 explicit SpellcheckService(content::BrowserContext* context); |
| 62 ~SpellcheckService() override; | 62 ~SpellcheckService() override; |
| 63 | 63 |
| 64 base::WeakPtr<SpellcheckService> GetWeakPtr(); | 64 base::WeakPtr<SpellcheckService> GetWeakPtr(); |
| 65 | 65 |
| 66 // This function computes a vector of strings which are to be displayed in | 66 // Computes |languages| to display in the context menu over a text area for |
| 67 // the context menu over a text area for changing spell check languages. It | 67 // changing spellcheck languages. Returns the number of the first spellcheck |
| 68 // returns the index of the current spell check language in the vector. | 68 // |languages| that are enabled. |
| 69 // |languages| will begin with all enabled spellcheck languages, followed by | |
|
please use gerrit instead
2015/06/06 01:42:12
Delete lines 69 to 72. They seem redundant.
Julius
2015/06/12 20:10:14
Done.
| |
| 70 // all other |accept_languages| not currently enabled for spellchecking. | |
| 71 // Therefore, it is only necessary to know how many of the first elements in | |
| 72 // |languages| are enabled dictionary languages. | |
| 69 // TODO(port): this should take a vector of base::string16, but the | 73 // TODO(port): this should take a vector of base::string16, but the |
| 70 // implementation has some dependencies in l10n util that need porting first. | 74 // implementation has some dependencies in l10n util that need porting first. |
| 71 static int GetSpellCheckLanguages(content::BrowserContext* context, | 75 static size_t GetSpellCheckLanguages(content::BrowserContext* context, |
| 72 std::vector<std::string>* languages); | 76 std::vector<std::string>* languages); |
| 73 | |
| 74 // Computes a vector of strings which are to be displayed in the context | |
| 75 // menu from |accept_languages| and |dictionary_language|. | |
| 76 static void GetSpellCheckLanguagesFromAcceptLanguages( | |
| 77 const std::vector<std::string>& accept_languages, | |
| 78 const std::string& dictionary_language, | |
| 79 std::vector<std::string>* languages); | |
| 80 | 77 |
| 81 // Signals the event attached by AttachTestEvent() to report the specified | 78 // Signals the event attached by AttachTestEvent() to report the specified |
| 82 // event to browser tests. This function is called by this class and its | 79 // event to browser tests. This function is called by this class and its |
| 83 // derived classes to report their status. This function does not do anything | 80 // derived classes to report their status. This function does not do anything |
| 84 // when we do not set an event to |status_event_|. | 81 // when we do not set an event to |status_event_|. |
| 85 static bool SignalStatusEvent(EventType type); | 82 static bool SignalStatusEvent(EventType type); |
| 86 | 83 |
| 87 // Instantiates SpellCheckHostMetrics object and makes it ready for recording | 84 // Instantiates SpellCheckHostMetrics object and makes it ready for recording |
| 88 // metrics. This should be called only if the metrics recording is active. | 85 // metrics. This should be called only if the metrics recording is active. |
| 89 void StartRecordingMetrics(bool spellcheck_enabled); | 86 void StartRecordingMetrics(bool spellcheck_enabled); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; | 169 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; |
| 173 | 170 |
| 174 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; | 171 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; |
| 175 | 172 |
| 176 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; | 173 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; |
| 177 | 174 |
| 178 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); | 175 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); |
| 179 }; | 176 }; |
| 180 | 177 |
| 181 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 178 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
| OLD | NEW |