Chromium Code Reviews| Index: components/translate/core/browser/translate_download_manager.h |
| diff --git a/components/translate/core/browser/translate_download_manager.h b/components/translate/core/browser/translate_download_manager.h |
| index a36ae235ccbae280a9d5ecfe0cbb5edbabc2442b..1291fc1eba056c2cf02b9293bb7ffb23a0216db3 100644 |
| --- a/components/translate/core/browser/translate_download_manager.h |
| +++ b/components/translate/core/browser/translate_download_manager.h |
| @@ -9,14 +9,18 @@ |
| #include "base/logging.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "components/translate/core/browser/translate_language_list.h" |
| #include "net/url_request/url_request_context_getter.h" |
| template <typename T> struct DefaultSingletonTraits; |
| +class PrefService; |
| + |
| // Manages the downloaded resources for Translate, such as the translate script |
| // and the language list. |
| -// TODO(droger): TranslateDownloadManager should own TranslateLanguageList and |
| -// TranslateScript. See http://crbug.com/335074 and http://crbug.com/335077. |
| +// TODO(droger): TranslateDownloadManager should own TranslateScript. |
| +// See http://crbug.com/335074. |
| class TranslateDownloadManager { |
| public: |
| // Returns the singleton instance. |
| @@ -39,11 +43,45 @@ class TranslateDownloadManager { |
| application_locale_ = locale; |
| } |
| + // The language list. |
| + TranslateLanguageList* language_list() { return language_list_.get(); } |
| + |
| + // Let the caller decide if and when we should fetch the language list from |
| + // the translate server. This is a NOOP if switches::kDisableTranslate is set |
| + // or if prefs::kEnableTranslate is set to false. |
| + static void RequestLanguageList(PrefService* prefs); |
| + |
| + // Fetches the language list from the translate server. |
| + static void RequestLanguageList(); |
| + |
| + // Fills |languages| with the list of languages that the translate server can |
| + // translate to and from. |
| + static void GetSupportedLanguages(std::vector<std::string>* languages); |
| + |
| + // Returns the last-updated time when Chrome receives a language list from a |
|
MAD
2014/02/03 14:02:43
receives -> received?
|
| + // Translate server. Returns null time if Chrome hasn't received any lists. |
| + static base::Time GetSupportedLanguagesLastUpdated(); |
| + |
| + // Returns the language code that can be used with the Translate method for a |
| + // specified |chrome_locale|. |
| + static std::string GetLanguageCode(const std::string& chrome_locale); |
| + |
| + // Returns true if |language| is supported by the translation server. |
| + static bool IsSupportedLanguage(const std::string& language); |
| + |
| + // Returns true if |language| is supported by the translation server as a |
| + // alpha language. |
|
MAD
2014/02/03 14:02:43
a alpha -> an alpha?
|
| + static bool IsAlphaLanguage(const std::string& language); |
| + |
| + // Must be called to shut Translate down. Cancels any pending fetches. |
| + void Shutdown(); |
| + |
| private: |
| friend struct DefaultSingletonTraits<TranslateDownloadManager>; |
| TranslateDownloadManager(); |
| virtual ~TranslateDownloadManager(); |
| + scoped_ptr<TranslateLanguageList> language_list_; |
| std::string application_locale_; |
| scoped_refptr<net::URLRequestContextGetter> request_context_; |
| }; |