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

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

Issue 3034013: Fetch the translate script regularly (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Synced Created 10 years, 5 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 260f3456725f22872ae4e8a5cf62d1a48a7c3aca..54debf429ae142dce43a136e893bbbff6a1b7e52 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -51,7 +51,6 @@ class TranslateManager : public NotificationObserver,
void ReportLanguageDetectionError(TabContents* tab_contents);
// Clears the translate script, so it will be fetched next time we translate.
- // Currently used by unit-tests.
void ClearTranslateScript() { translate_script_.clear(); }
// NotificationObserver implementation:
@@ -67,6 +66,12 @@ class TranslateManager : public NotificationObserver,
const ResponseCookies& cookies,
const std::string& data);
+ // Used by unit-tests to override the default delay after which the translate
+ // script is fetched again from the translation server.
+ void set_translate_script_expiration_delay(int delay_ms) {
+ translate_script_expiration_delay_ = delay_ms;
+ }
+
// Convenience method to know if a tab is showing a translate infobar.
static bool IsShowingTranslateInfobar(TabContents* tab);
@@ -158,6 +163,10 @@ class TranslateManager : public NotificationObserver,
// The JS injected in the page to do the translation.
std::string translate_script_;
+ // Delay in milli-seconds after which the translate script is fetched again
+ // from the translate server.
+ int translate_script_expiration_delay_;
+
// Whether the translate JS is currently being retrieved.
bool translate_script_request_pending_;
« no previous file with comments | « chrome/browser/translate/translate_infobar_delegate.cc ('k') | chrome/browser/translate/translate_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698