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

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 comments, added browser tests, rebased. Created 5 years, 6 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
68 // returns the index of the current spell check language in the vector. 68 // languages. It returns the number of current spell check languages in
69 // |languages|.
please use gerrit instead 2015/06/04 19:41:06 s/current/enabled Explain why the return value is
Julius 2015/06/05 03:41:13 Done.
69 // 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
70 // implementation has some dependencies in l10n util that need porting first. 71 // implementation has some dependencies in l10n util that need porting first.
71 static int GetSpellCheckLanguages(content::BrowserContext* context, 72 static int GetSpellCheckLanguages(
please use gerrit instead 2015/06/04 19:41:05 Since you're returning the number of the first |la
Julius 2015/06/05 03:41:12 Done.
72 std::vector<std::string>* languages); 73 content::BrowserContext* context,
please use gerrit instead 2015/06/04 19:41:06 Can you make this pointer "const" to clarify that
Julius 2015/06/05 03:41:12 Done.
74 std::vector<std::string>* languages);
73 75
74 // Computes a vector of strings which are to be displayed in the context 76 // Computes a vector of strings which are to be displayed in the context
75 // menu from |accept_languages| and |dictionary_language|. 77 // menu from |accept_languages| and |dictionary_languages|.
76 static void GetSpellCheckLanguagesFromAcceptLanguages( 78 static void GetSpellCheckLanguagesFromAcceptLanguages(
please use gerrit instead 2015/06/04 19:41:06 Inline this function's code into GetSpellCheckLang
Julius 2015/06/05 03:41:13 Done.
77 const std::vector<std::string>& accept_languages, 79 const std::vector<std::string>& accept_languages,
78 const std::string& dictionary_language,
79 std::vector<std::string>* languages); 80 std::vector<std::string>* languages);
80 81
81 // Signals the event attached by AttachTestEvent() to report the specified 82 // Signals the event attached by AttachTestEvent() to report the specified
82 // event to browser tests. This function is called by this class and its 83 // 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 84 // derived classes to report their status. This function does not do anything
84 // when we do not set an event to |status_event_|. 85 // when we do not set an event to |status_event_|.
85 static bool SignalStatusEvent(EventType type); 86 static bool SignalStatusEvent(EventType type);
86 87
87 // Instantiates SpellCheckHostMetrics object and makes it ready for recording 88 // Instantiates SpellCheckHostMetrics object and makes it ready for recording
88 // metrics. This should be called only if the metrics recording is active. 89 // metrics. This should be called only if the metrics recording is active.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; 173 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_;
173 174
174 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_; 175 scoped_ptr<spellcheck::FeedbackSender> feedback_sender_;
175 176
176 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; 177 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_;
177 178
178 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); 179 DISALLOW_COPY_AND_ASSIGN(SpellcheckService);
179 }; 180 };
180 181
181 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ 182 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698