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 // This function computes a vector of strings, |languages|, which are to be |
please use gerrit instead
2015/06/05 17:50:05
// Computes |languages| to display in the context
Julius
2015/06/05 21:38:33
Done.
| |
67 // the context menu over a text area for changing spell check languages. It | 67 // displayed in the context menu over a text area for changing spell check |
please use gerrit instead
2015/06/05 17:50:05
s/spell check/spellcheck
Stick with your own conv
Julius
2015/06/05 21:38:33
Done.
| |
68 // returns the index of the current spell check language in the vector. | 68 // languages. It returns the number of enabled spellcheck languages in |
please use gerrit instead
2015/06/05 17:50:05
Not sure how to say this better, but let me try to
Julius
2015/06/05 21:38:33
Done.
| |
69 // |languages|. | |
70 // |languages| will begin with all enabled spellcheck languages, followed by | |
71 // all other |accept_languages| not currently enabled for spellchecking. | |
72 // Therefore, it is only necessary to know how many of the first elements in | |
73 // |languages| are enabled dictionary languages. | |
69 // TODO(port): this should take a vector of base::string16, but the | 74 // TODO(port): this should take a vector of base::string16, but the |
70 // implementation has some dependencies in l10n util that need porting first. | 75 // implementation has some dependencies in l10n util that need porting first. |
71 static int GetSpellCheckLanguages(content::BrowserContext* context, | 76 static size_t GetSpellCheckLanguages(const content::BrowserContext* context, |
72 std::vector<std::string>* languages); | 77 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 | 78 |
81 // Signals the event attached by AttachTestEvent() to report the specified | 79 // Signals the event attached by AttachTestEvent() to report the specified |
82 // event to browser tests. This function is called by this class and its | 80 // 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 | 81 // derived classes to report their status. This function does not do anything |
84 // when we do not set an event to |status_event_|. | 82 // when we do not set an event to |status_event_|. |
85 static bool SignalStatusEvent(EventType type); | 83 static bool SignalStatusEvent(EventType type); |
86 | 84 |
87 // Instantiates SpellCheckHostMetrics object and makes it ready for recording | 85 // Instantiates SpellCheckHostMetrics object and makes it ready for recording |
88 // metrics. This should be called only if the metrics recording is active. | 86 // metrics. This should be called only if the metrics recording is active. |
89 void StartRecordingMetrics(bool spellcheck_enabled); | 87 void StartRecordingMetrics(bool spellcheck_enabled); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; | 170 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; |
173 | 171 |
174 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; | 172 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; |
175 | 173 |
176 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; | 174 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; |
177 | 175 |
178 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); | 176 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); |
179 }; | 177 }; |
180 | 178 |
181 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 179 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
OLD | NEW |