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

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

Issue 14846026: [Translate] When reloading a page Wait until some content has actually been re-loaded before trigg… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/translate/translate_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/translate/translate_manager.h
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index 78b3a3f856f87843ffab32ed8c9970689a7e4af0..5a243782fb136028aa95d4c5399c8824b8bcefa5 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -86,13 +86,19 @@ class TranslateManager : public content::NotificationObserver,
// net::URLFetcherDelegate implementation:
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
- // Used by unit-tests to override the default delay after which the translate
- // script is fetched again from the translation server.
+ // Used by unit-tests to override some defaults:
+ // 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_ =
base::TimeDelta::FromMilliseconds(delay_ms);
}
+ // Number of attempts before waiting for a page to be fully reloaded.
+ void set_translate_max_reload_attemps(int attempts) {
+ max_reload_check_attempts_ = attempts;
+ }
+
// Returns true if the URL can be translated.
static bool IsTranslatableURL(const GURL& url);
@@ -142,9 +148,8 @@ class TranslateManager : public content::NotificationObserver,
// If the tab identified by |process_id| and |render_id| has been closed, this
// does nothing, otherwise it calls InitiateTranslation.
- void InitiateTranslationPosted(int process_id,
- int render_id,
- const std::string& page_lang);
+ void InitiateTranslationPosted(int process_id, int render_id,
+ const std::string& page_lang, int attempt);
// Sends a translation request to the RenderView of |web_contents|.
void DoTranslatePage(content::WebContents* web_contents,
@@ -202,6 +207,9 @@ class TranslateManager : public content::NotificationObserver,
// from the translate server.
base::TimeDelta translate_script_expiration_delay_;
+ // Max number of attempts before checking if a page has been reloaded.
+ int max_reload_check_attempts_;
+
// Set when the translate JS is currently being retrieved. NULL otherwise.
scoped_ptr<net::URLFetcher> translate_script_request_pending_;
« no previous file with comments | « no previous file | chrome/browser/translate/translate_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698