| 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..4a5cfc644848240f3040fe07a44980e6474b455c 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() ?
|
| @@ -363,33 +355,27 @@ void ChromeRenderViewObserver::DidStopLoading() {
|
| void ChromeRenderViewObserver::DidCommitProvisionalLoad(
|
| WebLocalFrame* frame, bool is_new_navigation) {
|
| // Don't capture pages being not new, or including refresh meta tag.
|
| - if (!is_new_navigation || HasRefreshMetaTag(frame))
|
| + if (!is_new_navigation || HasRefreshMetaTag(frame)) {
|
| + capture_timer_.Stop();
|
| 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 +409,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)
|
|
|