Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_service.h

Issue 1156473007: Enables the user to select multiple languages for spellchecking (UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replied to old comments and fixed small issues. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 DICT_HUNSPELL, 57 DICT_HUNSPELL,
58 DICT_TEXT, 58 DICT_TEXT,
59 DICT_UNKNOWN, 59 DICT_UNKNOWN,
60 }; 60 };
61 61
62 explicit SpellcheckService(content::BrowserContext* context); 62 explicit SpellcheckService(content::BrowserContext* context);
63 ~SpellcheckService() override; 63 ~SpellcheckService() override;
64 64
65 base::WeakPtr<SpellcheckService> GetWeakPtr(); 65 base::WeakPtr<SpellcheckService> GetWeakPtr();
66 66
67 // This function computes a vector of strings which are to be displayed in 67 // Computes |languages| to display in the context menu over a text area for
68 // the context menu over a text area for changing spell check languages. It 68 // changing spellcheck languages. Returns the number of languages that are
69 // returns the index of the current spell check language in the vector. 69 // enabled, which are always at the beginning of |languages|.
70 // TODO(port): this should take a vector of base::string16, but the 70 // TODO(port): this should take a vector of base::string16, but the
71 // implementation has some dependencies in l10n util that need porting first. 71 // implementation has some dependencies in l10n util that need porting first.
72 static int GetSpellCheckLanguages(base::SupportsUserData* context, 72 static size_t GetSpellCheckLanguages(base::SupportsUserData* context,
73 std::vector<std::string>* languages); 73 std::vector<std::string>* languages);
74 74
75 // Signals the event attached by AttachTestEvent() to report the specified 75 // Signals the event attached by AttachTestEvent() to report the specified
76 // event to browser tests. This function is called by this class and its 76 // 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 77 // derived classes to report their status. This function does not do anything
78 // when we do not set an event to |status_event_|. 78 // when we do not set an event to |status_event_|.
79 static bool SignalStatusEvent(EventType type); 79 static bool SignalStatusEvent(EventType type);
80 80
81 // Instantiates SpellCheckHostMetrics object and makes it ready for recording 81 // Instantiates SpellCheckHostMetrics object and makes it ready for recording
82 // metrics. This should be called only if the metrics recording is active. 82 // metrics. This should be called only if the metrics recording is active.
83 void StartRecordingMetrics(bool spellcheck_enabled); 83 void StartRecordingMetrics(bool spellcheck_enabled);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Returns the status event type. 135 // Returns the status event type.
136 static EventType GetStatusEvent(); 136 static EventType GetStatusEvent();
137 137
138 // Pass all renderers some basic initialization information. 138 // Pass all renderers some basic initialization information.
139 void InitForAllRenderers(); 139 void InitForAllRenderers();
140 140
141 // Reacts to a change in user preferences on whether auto-spell-correct should 141 // Reacts to a change in user preferences on whether auto-spell-correct should
142 // be enabled. 142 // be enabled.
143 void OnEnableAutoSpellCorrectChanged(); 143 void OnEnableAutoSpellCorrectChanged();
144 144
145 // Reacts to a change in user preference on which language should be used for 145 // Reacts to a change in user preference on which language should be used for
please use gerrit instead 2015/07/06 23:28:15 s/language/languages
Julius 2015/07/07 01:14:21 Done.
146 // spellchecking. 146 // spellchecking.
147 void OnSpellCheckDictionaryChanged(); 147 void OnSpellCheckDictionariesChanged();
148 148
149 // Notification handler for changes to prefs::kSpellCheckUseSpellingService. 149 // Notification handler for changes to prefs::kSpellCheckUseSpellingService.
150 void OnUseSpellingServiceChanged(); 150 void OnUseSpellingServiceChanged();
151 151
152 // Enables the feedback sender if spelling server is available and enabled. 152 // Enables the feedback sender if spelling server is available and enabled.
153 // Otherwise disables the feedback sender. 153 // Otherwise disables the feedback sender.
154 void UpdateFeedbackSenderState(); 154 void UpdateFeedbackSenderState();
155 155
156 PrefChangeRegistrar pref_change_registrar_; 156 PrefChangeRegistrar pref_change_registrar_;
157 content::NotificationRegistrar registrar_; 157 content::NotificationRegistrar registrar_;
158 158
159 // A pointer to the BrowserContext which this service refers to. 159 // A pointer to the BrowserContext which this service refers to.
160 content::BrowserContext* context_; 160 content::BrowserContext* context_;
161 161
162 scoped_ptr<SpellCheckHostMetrics> metrics_; 162 scoped_ptr<SpellCheckHostMetrics> metrics_;
163 163
164 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_; 164 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_;
165 165
166 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; 166 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_;
167 167
168 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; 168 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_;
169 169
170 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; 170 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_;
171 171
172 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); 172 DISALLOW_COPY_AND_ASSIGN(SpellcheckService);
173 }; 173 };
174 174
175 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ 175 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698