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

Unified Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 363293005: Remove page id from "page capture". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert to patch set 1 Created 6 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
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/chrome_render_view_observer.cc
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc
index f3603e7b181fb26c964c5ff514c2dd867b164b2e..b911e7a500e5813e0083154fc025cf4f3088fc3b 100644
--- a/chrome/renderer/chrome_render_view_observer.cc
+++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -96,12 +96,6 @@ static const char kTranslateCaptureText[] = "Translate.CaptureText";
namespace {
-GURL StripRef(const GURL& url) {
- GURL::Replacements replacements;
- replacements.ClearRef();
- return url.ReplaceComponents(replacements);
-}
-
#if defined(OS_ANDROID)
// Parses the DOM for a <meta> tag with a particular name.
// |meta_tag_content| is set to the contents of the 'content' attribute.
@@ -161,7 +155,6 @@ ChromeRenderViewObserver::ChromeRenderViewObserver(
chrome_render_process_observer_(chrome_render_process_observer),
translate_helper_(new TranslateHelper(render_view)),
phishing_classifier_(NULL),
- last_indexed_page_id_(-1),
capture_timer_(false, false) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (!command_line.HasSwitch(switches::kDisableClientSidePhishingDetection))
@@ -353,7 +346,6 @@ void ChromeRenderViewObserver::DidStopLoading() {
return;
CapturePageInfoLater(
- render_view()->GetPageId(),
false, // preliminary_capture
base::TimeDelta::FromMilliseconds(
render_view()->GetContentStateImmediately() ?
@@ -367,29 +359,21 @@ void ChromeRenderViewObserver::DidCommitProvisionalLoad(
return;
CapturePageInfoLater(
- render_view()->GetPageId(),
true, // preliminary_capture
base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs));
}
-void ChromeRenderViewObserver::CapturePageInfoLater(int page_id,
- bool preliminary_capture,
+void ChromeRenderViewObserver::CapturePageInfoLater(bool preliminary_capture,
base::TimeDelta delay) {
capture_timer_.Start(
FROM_HERE,
delay,
base::Bind(&ChromeRenderViewObserver::CapturePageInfo,
base::Unretained(this),
- page_id,
preliminary_capture));
}
-void ChromeRenderViewObserver::CapturePageInfo(int page_id,
- bool preliminary_capture) {
- // If |page_id| is obsolete, we should stop indexing and capturing a page.
- if (render_view()->GetPageId() != page_id)
- return;
-
+void ChromeRenderViewObserver::CapturePageInfo(bool preliminary_capture) {
if (!render_view()->GetWebView())
return;
@@ -423,39 +407,6 @@ void ChromeRenderViewObserver::CapturePageInfo(int page_id,
if (translate_helper_)
translate_helper_->PageCaptured(contents);
- // TODO(shess): Is indexing "Full text search" indexing? In that
- // case more of this can go.
- // Skip indexing if this is not a new load. Note that the case where
- // page_id == last_indexed_page_id_ is more complicated, since we need to
- // reindex if the toplevel URL has changed (such as from a redirect), even
- // though this may not cause the page id to be incremented.
- if (page_id < last_indexed_page_id_)
- return;
-
- bool same_page_id = last_indexed_page_id_ == page_id;
- if (!preliminary_capture)
- last_indexed_page_id_ = page_id;
-
- // Get the URL for this page.
- GURL url(main_frame->document().url());
- if (url.is_empty()) {
- if (!preliminary_capture)
- last_indexed_url_ = GURL();
- return;
- }
-
- // If the page id is unchanged, check whether the URL (ignoring fragments)
- // has changed. If so, we need to reindex. Otherwise, assume this is a
- // reload, in-page navigation, or some other load type where we don't want to
- // reindex. Note: subframe navigations after onload increment the page id,
- // so these will trigger a reindex.
- GURL stripped_url(StripRef(url));
- if (same_page_id && stripped_url == last_indexed_url_)
- return;
-
- if (!preliminary_capture)
- last_indexed_url_ = stripped_url;
-
TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo");
#if defined(FULL_SAFE_BROWSING)
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698