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_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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // translate to and from. | 108 // translate to and from. |
109 static void GetSupportedLanguages(std::vector<std::string>* languages); | 109 static void GetSupportedLanguages(std::vector<std::string>* languages); |
110 | 110 |
111 // Returns the language code that can be used with the Translate method for a | 111 // Returns the language code that can be used with the Translate method for a |
112 // specified |chrome_locale|. | 112 // specified |chrome_locale|. |
113 static std::string GetLanguageCode(const std::string& chrome_locale); | 113 static std::string GetLanguageCode(const std::string& chrome_locale); |
114 | 114 |
115 // Returns true if |language| is supported by the translation server. | 115 // Returns true if |language| is supported by the translation server. |
116 static bool IsSupportedLanguage(const std::string& language); | 116 static bool IsSupportedLanguage(const std::string& language); |
117 | 117 |
| 118 // Returns true if infobar can display a name for |language| is the current UI |
| 119 // locale. |
| 120 static bool IsAvailableLanguage(const std::string& language); |
| 121 |
118 // static const values shared with our browser tests. | 122 // static const values shared with our browser tests. |
119 static const char kLanguageListCallbackName[]; | 123 static const char kLanguageListCallbackName[]; |
120 static const char kTargetLanguagesKey[]; | 124 static const char kTargetLanguagesKey[]; |
121 | 125 |
122 // The observer class for TranslateManager. | 126 // The observer class for TranslateManager. |
123 class Observer { | 127 class Observer { |
124 public: | 128 public: |
125 virtual void OnLanguageDetection( | 129 virtual void OnLanguageDetection( |
126 const LanguageDetectionDetails& details) = 0; | 130 const LanguageDetectionDetails& details) = 0; |
127 }; | 131 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // The languages supported by the translation server. | 246 // The languages supported by the translation server. |
243 static base::LazyInstance<std::set<std::string> > supported_languages_; | 247 static base::LazyInstance<std::set<std::string> > supported_languages_; |
244 | 248 |
245 // List of registered observers. | 249 // List of registered observers. |
246 ObserverList<Observer> observer_list_; | 250 ObserverList<Observer> observer_list_; |
247 | 251 |
248 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 252 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
249 }; | 253 }; |
250 | 254 |
251 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 255 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
OLD | NEW |