OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TRANSLATE_TRANSLATE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // the UI language | 174 // the UI language |
175 // the accept-language list | 175 // the accept-language list |
176 // If no language is found then an empty string is returned. | 176 // If no language is found then an empty string is returned. |
177 static std::string GetTargetLanguage(PrefService* prefs); | 177 static std::string GetTargetLanguage(PrefService* prefs); |
178 | 178 |
179 // Returns the translate info bar showing in |tab| or NULL if none is showing. | 179 // Returns the translate info bar showing in |tab| or NULL if none is showing. |
180 static TranslateInfoBarDelegate* GetTranslateInfoBarDelegate( | 180 static TranslateInfoBarDelegate* GetTranslateInfoBarDelegate( |
181 TabContents* tab); | 181 TabContents* tab); |
182 | 182 |
183 NotificationRegistrar notification_registrar_; | 183 NotificationRegistrar notification_registrar_; |
184 PrefChangeRegistrar pref_change_registrar_; | 184 |
| 185 // Each PrefChangeRegistrar only tracks a single PrefService, so a map from |
| 186 // each PrefService used to its registrar is needed. |
| 187 typedef std::map<PrefService*, PrefChangeRegistrar*> PrefServiceRegistrarMap; |
| 188 PrefServiceRegistrarMap pref_change_registrars_; |
185 | 189 |
186 // A map that associates a profile with its parsed "accept languages". | 190 // A map that associates a profile with its parsed "accept languages". |
187 typedef std::set<std::string> LanguageSet; | 191 typedef std::set<std::string> LanguageSet; |
188 typedef std::map<PrefService*, LanguageSet> PrefServiceLanguagesMap; | 192 typedef std::map<PrefService*, LanguageSet> PrefServiceLanguagesMap; |
189 PrefServiceLanguagesMap accept_languages_; | 193 PrefServiceLanguagesMap accept_languages_; |
190 | 194 |
191 ScopedRunnableMethodFactory<TranslateManager> method_factory_; | 195 ScopedRunnableMethodFactory<TranslateManager> method_factory_; |
192 | 196 |
193 // The JS injected in the page to do the translation. | 197 // The JS injected in the page to do the translation. |
194 std::string translate_script_; | 198 std::string translate_script_; |
(...skipping 14 matching lines...) Expand all Loading... |
209 // server. | 213 // server. |
210 std::vector<PendingRequest> pending_requests_; | 214 std::vector<PendingRequest> pending_requests_; |
211 | 215 |
212 // The languages supported by the translation server. | 216 // The languages supported by the translation server. |
213 static base::LazyInstance<std::set<std::string> > supported_languages_; | 217 static base::LazyInstance<std::set<std::string> > supported_languages_; |
214 | 218 |
215 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 219 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
216 }; | 220 }; |
217 | 221 |
218 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 222 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
OLD | NEW |