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

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

Issue 654653002: Enables the user to select multiple languages for spellchecking (UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 5 years, 10 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 "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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 DICT_HUNSPELL, 49 DICT_HUNSPELL,
50 DICT_TEXT, 50 DICT_TEXT,
51 DICT_UNKNOWN, 51 DICT_UNKNOWN,
52 }; 52 };
53 53
54 explicit SpellcheckService(content::BrowserContext* context); 54 explicit SpellcheckService(content::BrowserContext* context);
55 ~SpellcheckService() override; 55 ~SpellcheckService() override;
56 56
57 // This function computes a vector of strings which are to be displayed in 57 // This function computes a vector of strings which are to be displayed in
58 // the context menu over a text area for changing spell check languages. It 58 // the context menu over a text area for changing spell check languages. It
59 // returns the index of the current spell check language in the vector. 59 // returns the set of indices of the current spell check languages in the
60 // vector.
60 // 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
61 // implementation has some dependencies in l10n util that need porting first. 62 // implementation has some dependencies in l10n util that need porting first.
62 static int GetSpellCheckLanguages(content::BrowserContext* context, 63 static std::set<int> GetSpellCheckLanguages(
63 std::vector<std::string>* languages); 64 content::BrowserContext* context,
65 std::vector<std::string>* languages);
64 66
65 // 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
66 // menu from |accept_languages| and |dictionary_language|. 68 // menu from |accept_languages| and |dictionary_language|.
67 static void GetSpellCheckLanguagesFromAcceptLanguages( 69 static void GetSpellCheckLanguagesFromAcceptLanguages(
68 const std::vector<std::string>& accept_languages, 70 const std::vector<std::string>& accept_languages,
69 const std::string& dictionary_language,
70 std::vector<std::string>* languages); 71 std::vector<std::string>* languages);
71 72
72 // Signals the event attached by AttachTestEvent() to report the specified 73 // Signals the event attached by AttachTestEvent() to report the specified
73 // 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
74 // 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
75 // when we do not set an event to |status_event_|. 76 // when we do not set an event to |status_event_|.
76 static bool SignalStatusEvent(EventType type); 77 static bool SignalStatusEvent(EventType type);
77 78
78 // Instantiates SpellCheckHostMetrics object and makes it ready for recording 79 // Instantiates SpellCheckHostMetrics object and makes it ready for recording
79 // 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_; 155 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_;
155 156
156 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; 157 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_;
157 158
158 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; 159 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_;
159 160
160 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); 161 DISALLOW_COPY_AND_ASSIGN(SpellcheckService);
161 }; 162 };
162 163
163 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ 164 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698