| 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..c1f9164a33ebfa96fe8b777979295c61f007d7e2 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 received a language list from a
|
| + // 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 an
|
| + // alpha language.
|
| + 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_;
|
| };
|
|
|