Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: chrome/browser/translate/translate_manager.h

Issue 15317007: Translate: split supporting language list handling to TranslateLanguageList (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: plan b Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/translate_manager.h
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index 166ac95527ef9f0e037a6bded1321b04bd3215d4..2a01d9dfa84cf5c5f075d54e37692c343e9b9dc0 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -11,7 +11,6 @@
#include <vector>
#include "base/gtest_prod_util.h"
-#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
@@ -29,6 +28,7 @@ struct PageTranslatedDetails;
class PrefService;
struct ShortcutConfiguration;
class TranslateInfoBarDelegate;
+class TranslateLanguageList;
namespace content {
class WebContents;
@@ -52,9 +52,8 @@ class TranslateManager : public content::NotificationObserver,
virtual ~TranslateManager();
// 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.
- // It will not retry more than kMaxRetryLanguageListFetch times.
+ // the translate server. This is a NOOP if switches::kDisableTranslate is set
+ // or if prefs::kEnableTranslate is set to false.
void FetchLanguageListFromTranslateServer(PrefService* prefs);
// Allows caller to cleanup pending URLFetcher objects to make sure they
@@ -115,10 +114,6 @@ class TranslateManager : public content::NotificationObserver,
// Returns true if |language| is supported by the translation server.
static bool IsSupportedLanguage(const std::string& language);
- // static const values shared with our browser tests.
- static const char kLanguageListCallbackName[];
- static const char kTargetLanguagesKey[];
-
// The observer class for TranslateManager.
class Observer {
public:
@@ -147,14 +142,6 @@ class TranslateManager : public content::NotificationObserver,
std::string target_lang;
};
- // Fills supported_languages_ with the list of languages that the translate
- // server can translate to and from.
- static void SetSupportedLanguages(const std::string& language_list);
-
- // Initializes the list of supported languages if it wasn't initialized before
- // in case we failed to get them from the server, or didn't get them just yet.
- static void InitSupportedLanguages();
-
// Starts the translation process on |tab| containing the page in the
// |page_lang| language.
void InitiateTranslation(content::WebContents* web_contents,
@@ -230,21 +217,18 @@ class TranslateManager : public content::NotificationObserver,
// Set when the translate JS is currently being retrieved. NULL otherwise.
scoped_ptr<net::URLFetcher> translate_script_request_pending_;
- // Set when the list of languages is currently being retrieved.
- // NULL otherwise.
- scoped_ptr<net::URLFetcher> language_list_request_pending_;
-
// The list of pending translate requests. Translate requests are queued when
// the translate script is not ready and has to be fetched from the translate
// server.
std::vector<PendingRequest> pending_requests_;
- // The languages supported by the translation server.
- static base::LazyInstance<std::set<std::string> > supported_languages_;
-
// List of registered observers.
ObserverList<Observer> observer_list_;
+ // An instance of TranslateLanguageList which manages supporting language
MAD 2013/05/27 21:34:35 supporting -> supported
Takashi Toyoshima 2013/05/28 07:35:28 Done.
+ // list.
+ scoped_ptr<TranslateLanguageList> language_list_;
+
DISALLOW_COPY_AND_ASSIGN(TranslateManager);
};

Powered by Google App Engine
This is Rietveld 408576698