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

Unified Diff: chrome/renderer/chrome_render_frame_observer.cc

Issue 1774663002: Teach CRFO:CapturePageText to recognize page refreshes with long delays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits. Created 4 years, 9 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/renderer/chrome_render_frame_observer.cc
diff --git a/chrome/renderer/chrome_render_frame_observer.cc b/chrome/renderer/chrome_render_frame_observer.cc
index b49f1beea218117dbbd65ff3815aed22b42ed47e..9ce97ebda83a27a8c7495710c4b18f6ceeb2f612 100644
--- a/chrome/renderer/chrome_render_frame_observer.cc
+++ b/chrome/renderer/chrome_render_frame_observer.cc
@@ -64,6 +64,10 @@ static const size_t kMaxIndexChars = 65535;
// Constants for UMA statistic collection.
static const char kTranslateCaptureText[] = "Translate.CaptureText";
+// For a page that auto-refreshes, we still show the bubble, if
+// the refresh delay is less than this value (in seconds).
+static const double kLocationChangeIntervalInSeconds = 10;
+
namespace {
// If the source image is null or occupies less area than
@@ -338,7 +342,7 @@ void ChromeRenderFrameObserver::CapturePageText(TextCaptureType capture_type) {
return;
// Don't capture pages that have pending redirect or location change.
- if (frame->isNavigationScheduled())
+ if (frame->isNavigationScheduledWithin(kLocationChangeIntervalInSeconds))
return;
// Don't index/capture pages that are in view source mode.
« no previous file with comments | « chrome/browser/translate/translate_browsertest.cc ('k') | chrome/test/data/translate/refresh_meta_tag_long.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698