| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 static base::Time GetSupportedLanguagesLastUpdated(); | 67 static base::Time GetSupportedLanguagesLastUpdated(); |
| 68 | 68 |
| 69 // Returns the language code that can be used with the Translate method for a | 69 // Returns the language code that can be used with the Translate method for a |
| 70 // specified |language|. (ex. GetLanguageCode("en-US") will return "en", and | 70 // specified |language|. (ex. GetLanguageCode("en-US") will return "en", and |
| 71 // GetLanguageCode("zh-CN") returns "zh-CN") | 71 // GetLanguageCode("zh-CN") returns "zh-CN") |
| 72 static std::string GetLanguageCode(const std::string& language); | 72 static std::string GetLanguageCode(const std::string& language); |
| 73 | 73 |
| 74 // Returns true if |language| is supported by the translation server. | 74 // Returns true if |language| is supported by the translation server. |
| 75 static bool IsSupportedLanguage(const std::string& language); | 75 static bool IsSupportedLanguage(const std::string& language); |
| 76 | 76 |
| 77 // Returns true if |language| is supported by the translation server as an | |
| 78 // alpha language. | |
| 79 static bool IsAlphaLanguage(const std::string& language); | |
| 80 | |
| 81 // Must be called to shut Translate down. Cancels any pending fetches. | 77 // Must be called to shut Translate down. Cancels any pending fetches. |
| 82 void Shutdown(); | 78 void Shutdown(); |
| 83 | 79 |
| 84 // Clears the translate script, so it will be fetched next time we translate. | 80 // Clears the translate script, so it will be fetched next time we translate. |
| 85 void ClearTranslateScriptForTesting(); | 81 void ClearTranslateScriptForTesting(); |
| 86 | 82 |
| 87 // Resets to its initial state as if newly created. | 83 // Resets to its initial state as if newly created. |
| 88 void ResetForTesting(); | 84 void ResetForTesting(); |
| 89 | 85 |
| 90 // Used by unit-tests to override some defaults: | 86 // Used by unit-tests to override some defaults: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 103 // Translate. | 99 // Translate. |
| 104 std::unique_ptr<TranslateScript> script_; | 100 std::unique_ptr<TranslateScript> script_; |
| 105 | 101 |
| 106 std::string application_locale_; | 102 std::string application_locale_; |
| 107 scoped_refptr<net::URLRequestContextGetter> request_context_; | 103 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 108 }; | 104 }; |
| 109 | 105 |
| 110 } // namespace translate | 106 } // namespace translate |
| 111 | 107 |
| 112 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ | 108 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |