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 "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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 DICT_UNKNOWN, | 52 DICT_UNKNOWN, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 explicit SpellcheckService(content::BrowserContext* context); | 55 explicit SpellcheckService(content::BrowserContext* context); |
| 56 ~SpellcheckService() override; | 56 ~SpellcheckService() override; |
| 57 | 57 |
| 58 base::WeakPtr<SpellcheckService> GetWeakPtr(); | 58 base::WeakPtr<SpellcheckService> GetWeakPtr(); |
| 59 | 59 |
| 60 // This function computes a vector of strings which are to be displayed in | 60 // This function computes a vector of strings which are to be displayed in |
| 61 // the context menu over a text area for changing spell check languages. It | 61 // the context menu over a text area for changing spell check languages. It |
| 62 // returns the index of the current spell check language in the vector. | 62 // returns the set of indices of the current spell check languages in the |
|
Julius
2015/06/03 21:18:39
Done.
| |
| 63 // vector. | |
| 63 // TODO(port): this should take a vector of base::string16, but the | 64 // TODO(port): this should take a vector of base::string16, but the |
| 64 // implementation has some dependencies in l10n util that need porting first. | 65 // implementation has some dependencies in l10n util that need porting first. |
| 65 static int GetSpellCheckLanguages(content::BrowserContext* context, | 66 static std::set<int> GetSpellCheckLanguages( |
|
Julius
2015/06/03 21:18:39
Changed to an int because this return value is sup
| |
| 66 std::vector<std::string>* languages); | 67 content::BrowserContext* context, |
| 68 std::vector<std::string>* languages); | |
| 67 | 69 |
| 68 // Computes a vector of strings which are to be displayed in the context | 70 // Computes a vector of strings which are to be displayed in the context |
| 69 // menu from |accept_languages| and |dictionary_language|. | 71 // menu from |accept_languages| and |dictionary_language|. |
| 70 static void GetSpellCheckLanguagesFromAcceptLanguages( | 72 static void GetSpellCheckLanguagesFromAcceptLanguages( |
| 71 const std::vector<std::string>& accept_languages, | 73 const std::vector<std::string>& accept_languages, |
| 72 const std::string& dictionary_language, | |
| 73 std::vector<std::string>* languages); | 74 std::vector<std::string>* languages); |
| 74 | 75 |
| 75 // Signals the event attached by AttachTestEvent() to report the specified | 76 // Signals the event attached by AttachTestEvent() to report the specified |
| 76 // event to browser tests. This function is called by this class and its | 77 // event to browser tests. This function is called by this class and its |
| 77 // derived classes to report their status. This function does not do anything | 78 // derived classes to report their status. This function does not do anything |
| 78 // when we do not set an event to |status_event_|. | 79 // when we do not set an event to |status_event_|. |
| 79 static bool SignalStatusEvent(EventType type); | 80 static bool SignalStatusEvent(EventType type); |
| 80 | 81 |
| 81 // Instantiates SpellCheckHostMetrics object and makes it ready for recording | 82 // Instantiates SpellCheckHostMetrics object and makes it ready for recording |
| 82 // metrics. This should be called only if the metrics recording is active. | 83 // metrics. This should be called only if the metrics recording is active. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; | 167 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; |
| 167 | 168 |
| 168 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; | 169 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; |
| 169 | 170 |
| 170 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; | 171 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; |
| 171 | 172 |
| 172 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); | 173 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); |
| 173 }; | 174 }; |
| 174 | 175 |
| 175 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 176 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
| OLD | NEW |