| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 explicit SpellcheckService(content::BrowserContext* context); | 55 explicit SpellcheckService(content::BrowserContext* context); |
| 56 virtual ~SpellcheckService(); | 56 virtual ~SpellcheckService(); |
| 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 std::set<int> GetSpellCheckLanguages( |
| 64 std::vector<std::string>* languages); | 64 content::BrowserContext* context, |
| 65 std::vector<std::string>* languages); |
| 65 | 66 |
| 66 // Computes a vector of strings which are to be displayed in the context | 67 // Computes a vector of strings which are to be displayed in the context |
| 67 // menu from |accept_languages| and |dictionary_language|. | 68 // menu from |accept_languages| and |dictionary_language|. |
| 68 static void GetSpellCheckLanguagesFromAcceptLanguages( | 69 static void GetSpellCheckLanguagesFromAcceptLanguages( |
| 69 const std::vector<std::string>& accept_languages, | 70 const std::vector<std::string>& accept_languages, |
| 70 const std::string& dictionary_language, | |
| 71 std::vector<std::string>* languages); | 71 std::vector<std::string>* languages); |
| 72 | 72 |
| 73 // Signals the event attached by AttachTestEvent() to report the specified | 73 // Signals the event attached by AttachTestEvent() to report the specified |
| 74 // event to browser tests. This function is called by this class and its | 74 // event to browser tests. This function is called by this class and its |
| 75 // derived classes to report their status. This function does not do anything | 75 // derived classes to report their status. This function does not do anything |
| 76 // when we do not set an event to |status_event_|. | 76 // when we do not set an event to |status_event_|. |
| 77 static bool SignalStatusEvent(EventType type); | 77 static bool SignalStatusEvent(EventType type); |
| 78 | 78 |
| 79 // Instantiates SpellCheckHostMetrics object and makes it ready for recording | 79 // Instantiates SpellCheckHostMetrics object and makes it ready for recording |
| 80 // metrics. This should be called only if the metrics recording is active. | 80 // 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... |
| 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 |