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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 application_locale_ = locale; | 44 application_locale_ = locale; |
45 } | 45 } |
46 | 46 |
47 // The language list. | 47 // The language list. |
48 TranslateLanguageList* language_list() { return language_list_.get(); } | 48 TranslateLanguageList* language_list() { return language_list_.get(); } |
49 | 49 |
50 // The translate script. | 50 // The translate script. |
51 TranslateScript* script() { return script_.get(); } | 51 TranslateScript* script() { return script_.get(); } |
52 | 52 |
53 // Let the caller decide if and when we should fetch the language list from | 53 // Let the caller decide if and when we should fetch the language list from |
54 // the translate server. This is a NOOP if switches::kDisableTranslate is set | 54 // the translate server. This is a NOOP if prefs::kEnableTranslate is set to |
55 // or if prefs::kEnableTranslate is set to false. | 55 // false. |
56 static void RequestLanguageList(PrefService* prefs); | 56 static void RequestLanguageList(PrefService* prefs); |
57 | 57 |
58 // Fetches the language list from the translate server. | |
59 static void RequestLanguageList(); | |
60 | |
61 // Fills |languages| with the list of languages that the translate server can | 58 // Fills |languages| with the list of languages that the translate server can |
62 // translate to and from. | 59 // translate to and from. |
63 static void GetSupportedLanguages(std::vector<std::string>* languages); | 60 static void GetSupportedLanguages(std::vector<std::string>* languages); |
64 | 61 |
65 // Returns the last-updated time when Chrome received a language list from a | 62 // Returns the last-updated time when Chrome received a language list from a |
66 // Translate server. Returns null time if Chrome hasn't received any lists. | 63 // Translate server. Returns null time if Chrome hasn't received any lists. |
67 static base::Time GetSupportedLanguagesLastUpdated(); | 64 static base::Time GetSupportedLanguagesLastUpdated(); |
68 | 65 |
69 // Returns the language code that can be used with the Translate method for a | 66 // 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 | 67 // specified |language|. (ex. GetLanguageCode("en-US") will return "en", and |
(...skipping 28 matching lines...) Expand all Loading... |
99 // Translate. | 96 // Translate. |
100 std::unique_ptr<TranslateScript> script_; | 97 std::unique_ptr<TranslateScript> script_; |
101 | 98 |
102 std::string application_locale_; | 99 std::string application_locale_; |
103 scoped_refptr<net::URLRequestContextGetter> request_context_; | 100 scoped_refptr<net::URLRequestContextGetter> request_context_; |
104 }; | 101 }; |
105 | 102 |
106 } // namespace translate | 103 } // namespace translate |
107 | 104 |
108 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ | 105 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
OLD | NEW |